From 0f785dbe377cbc7dde39dfd3fecc67a3d6c87add Mon Sep 17 00:00:00 2001 From: APN-Pucky Date: Sat, 5 May 2018 20:05:36 +0200 Subject: [PATCH] Support BGE Devotion --- SimpleTUOptimizeStarter.ahk | 2 +- SimpleTUOptimizeStarter.exe | Bin 837120 -> 837120 bytes sim.cpp | 103 ++++++++++++++++++++---------------- tyrant.cpp | 2 +- tyrant.h | 2 +- tyrant_optimize.cpp | 1 + 6 files changed, 60 insertions(+), 50 deletions(-) diff --git a/SimpleTUOptimizeStarter.ahk b/SimpleTUOptimizeStarter.ahk index cbaeda75..d2dadb7f 100644 --- a/SimpleTUOptimizeStarter.ahk +++ b/SimpleTUOptimizeStarter.ahk @@ -14,7 +14,7 @@ FileDelete, %file% MaxCardsSections := 100 -BGEffects := "none|Unity|Iron-Will|Cold-Sleep|Blood-Vengeance|Oath-of-Loyalty|Furiosity|TemporalBacklash|CriticalReach|Devour|HaltedOrders|ZealotsPreservation|Virulence|Enfeeble all X|Enhance all S X|Evolve n S1 S2|Heal all X|Mortar X|Protect all X|Rally all X|Siege all X|Strike all X|Weaken all X|Brigade|Bloodlust X|Counterflux|Divert|EnduringRage|Fortification|Heroism|Metamorphosis|Megamorphosis|Revenge X|TurningTides" +BGEffects := "none|Devotion|Unity|Iron-Will|Cold-Sleep|Blood-Vengeance|Oath-of-Loyalty|Furiosity|TemporalBacklash|CriticalReach|Devour|HaltedOrders|ZealotsPreservation|Virulence|Enfeeble all X|Enhance all S X|Evolve n S1 S2|Heal all X|Mortar X|Protect all X|Rally all X|Siege all X|Strike all X|Weaken all X|Brigade|Bloodlust X|Counterflux|Divert|EnduringRage|Fortification|Heroism|Metamorphosis|Megamorphosis|Revenge X|TurningTides" IniFileName := "data\SimpleTUOptimizeStarter.ini" IniSection := "onLoad" diff --git a/SimpleTUOptimizeStarter.exe b/SimpleTUOptimizeStarter.exe index f074f0f18987e129bb18f5dc3d50eb56867763ea..14eed0f6611b8a4e3961ecc796a285c1870cd742 100644 GIT binary patch delta 215 zcmZqZF>dHF-cZBHB+xr~B9r&zlZ^8j1)4LN+B2CLffz(H12GE_vjQ<25VHd@2M}`t zF&7YXZ_i}n@wUueXu`nogoObNc*1xY41g>c-v-DRLE;CX@l(+F6=?h(ApZ{|!n}^{ iiZ(obejF~TW%(tU`FY#db@2olGY2@jY}?24g&hDna4sPL delta 208 zcmZqZF>dHF-cZBH#L_!?B9r&zlZ^8jS(-DM+B2CLffz(H12GE_vjQ<25VHd@2M}`t zF&7YXZ_i}n@wUvJVZy-hgoObD!gv`BfGil_0LT|X;=7>nBhdIcX#55s{|_U=yqfKb aHavZP+jn&F1R8JW*~jyReY(O?9v%SO4l6DI diff --git a/sim.cpp b/sim.cpp index efa440b5..8c964d8e 100644 --- a/sim.cpp +++ b/sim.cpp @@ -704,70 +704,70 @@ struct PlayCard { setStorage(); placeCard(); - status->m_summoned = summoned; + status->m_summoned = summoned; unsigned played_faction_mask(0); unsigned same_faction_cards_count(0); - bool bge_megamorphosis = fd->bg_effects[fd->tapi][PassiveBGE::megamorphosis]; - //played_status = status; - //played_card = card; - - check_and_perform_bravery(fd,status); + bool bge_megamorphosis = fd->bg_effects[fd->tapi][PassiveBGE::megamorphosis]; + //played_status = status; + //played_card = card; + + check_and_perform_bravery(fd,status); if (status->m_delay == 0) { check_and_perform_valor(fd, status); } - //refresh/init absorb - if(status->has_skill(Skill::absorb)) - { - status->m_absorption = status->skill_base_value(Skill::absorb); - } - - - // 1. Evaluate skill Allegiance & count assaults with same faction (structures will be counted later) - // 2. Passive BGE Cold Sleep - for (CardStatus* status_i : fd->tap->assaults.m_indirect) - { - if (status_i == status || !is_alive(status_i)) { continue; } // except itself - //std::cout << status_description(status_i).c_str(); - _DEBUG_ASSERT(is_alive(status_i)); - if (bge_megamorphosis || (status_i->m_card->m_faction == card->m_faction)) + //refresh/init absorb + if(status->has_skill(Skill::absorb)) { - ++ same_faction_cards_count; - unsigned allegiance_value = status_i->skill(Skill::allegiance); - if (__builtin_expect(allegiance_value, false) && !status->m_summoned) - { - _DEBUG_MSG(1, "%s activates Allegiance %u\n", status_description(status_i).c_str(), allegiance_value); - if (! status_i->m_sundered) - { status_i->m_perm_attack_buff += allegiance_value; } - status_i->ext_hp(allegiance_value); - } + status->m_absorption = status->skill_base_value(Skill::absorb); } - if (__builtin_expect(fd->bg_effects[fd->tapi][PassiveBGE::coldsleep], false) - && status_i->m_protected_stasis && can_be_healed(status_i)) + + + // 1. Evaluate skill Allegiance & count assaults with same faction (structures will be counted later) + // 2. Passive BGE Cold Sleep + for (CardStatus* status_i : fd->tap->assaults.m_indirect) { - unsigned bge_value = (status_i->m_protected_stasis + 1) / 2; - _DEBUG_MSG(1, "Cold Sleep: %s heals itself for %u\n", status_description(status_i).c_str(), bge_value); - status_i->add_hp(bge_value); + if (status_i == status || !is_alive(status_i)) { continue; } // except itself + //std::cout << status_description(status_i).c_str(); + _DEBUG_ASSERT(is_alive(status_i)); + if (bge_megamorphosis || (status_i->m_card->m_faction == card->m_faction)) + { + ++ same_faction_cards_count; + unsigned allegiance_value = status_i->skill(Skill::allegiance); + if (__builtin_expect(allegiance_value, false) && !status->m_summoned) + { + _DEBUG_MSG(1, "%s activates Allegiance %u\n", status_description(status_i).c_str(), allegiance_value); + if (! status_i->m_sundered) + { status_i->m_perm_attack_buff += allegiance_value; } + status_i->ext_hp(allegiance_value); + } + } + if (__builtin_expect(fd->bg_effects[fd->tapi][PassiveBGE::coldsleep], false) + && status_i->m_protected_stasis && can_be_healed(status_i)) + { + unsigned bge_value = (status_i->m_protected_stasis + 1) / 2; + _DEBUG_MSG(1, "Cold Sleep: %s heals itself for %u\n", status_description(status_i).c_str(), bge_value); + status_i->add_hp(bge_value); + } } - } - // Setup faction marks (bitmap) for stasis (skill Stasis / Passive BGE TemporalBacklash) - // unless Passive BGE Megamorphosis is enabled - if (__builtin_expect(!bge_megamorphosis, true)) - { - played_faction_mask = (1u << card->m_faction); - // do played card have stasis? mark this faction for stasis check - if (__builtin_expect(status->skill(Skill::stasis), false) - || __builtin_expect(fd->bg_effects[fd->tapi][PassiveBGE::temporalbacklash] && status->skill(Skill::counter), false)) + // Setup faction marks (bitmap) for stasis (skill Stasis / Passive BGE TemporalBacklash) + // unless Passive BGE Megamorphosis is enabled + if (__builtin_expect(!bge_megamorphosis, true)) { - fd->tap->stasis_faction_bitmap |= played_faction_mask; + played_faction_mask = (1u << card->m_faction); + // do played card have stasis? mark this faction for stasis check + if (__builtin_expect(status->skill(Skill::stasis), false) + || __builtin_expect(fd->bg_effects[fd->tapi][PassiveBGE::temporalbacklash] && status->skill(Skill::counter), false)) + { + fd->tap->stasis_faction_bitmap |= played_faction_mask; + } } - } // Evaluate Passive BGE Oath-of-Loyalty - unsigned allegiance_value; + unsigned allegiance_value; if (__builtin_expect(fd->bg_effects[fd->tapi][PassiveBGE::oath_of_loyalty], false) && ((allegiance_value = status->skill(Skill::allegiance)) > 0)) { @@ -865,6 +865,15 @@ struct PlayCard } } + //Devotion BGE + if (__builtin_expect(fd->bg_effects[fd->tapi][PassiveBGE::devotion], false) && !summoned && card->m_category == CardCategory::normal && fd->tap->commander.m_card->m_faction == card->m_faction) + { + _DEBUG_MSG(1, "Devotion %s: Gains %u HP\n", + status_description(status).c_str(), (card->m_health+4)/5); + status->ext_hp((card->m_health+4)/5); //20% bonus health (rounded up) + } + + // resolve On-Play skills for (const auto& ss: card->m_skills_on_play) { diff --git a/tyrant.cpp b/tyrant.cpp index f31f0b7f..2ff0615d 100644 --- a/tyrant.cpp +++ b/tyrant.cpp @@ -49,7 +49,7 @@ const std::string passive_bge_names[PassiveBGE::num_passive_bges] = "Bloodlust", "Brigade", "Counterflux", "Divert", "EnduringRage", "Fortification", "Heroism", "ZealotsPreservation", "Metamorphosis", "Megamorphosis", "Revenge", "TurningTides", "Virulence", "HaltedOrders", "Devour", "CriticalReach", "TemporalBacklash", "Furiosity", "OathOfLoyalty", - "BloodVengeance", "ColdSleep", "IronWill", "Unity", + "BloodVengeance", "ColdSleep", "IronWill", "Unity", "Devotion", }; const std::string cardtype_names[CardType::num_cardtypes]{"Commander", "Assault", "Structure", }; diff --git a/tyrant.h b/tyrant.h index b599ceab..4bae44a7 100644 --- a/tyrant.h +++ b/tyrant.h @@ -84,7 +84,7 @@ enum PassiveBGE bloodlust, brigade, counterflux, divert, enduringrage, fortification, heroism, zealotspreservation, metamorphosis, megamorphosis, revenge, turningtides, virulence, haltedorders, devour, criticalreach, temporalbacklash, furiosity, oath_of_loyalty, - bloodvengeance, coldsleep,ironwill,unity, + bloodvengeance, coldsleep,ironwill,unity,devotion, // End of BGEs num_passive_bges diff --git a/tyrant_optimize.cpp b/tyrant_optimize.cpp index b1de624c..4ed1cd04 100644 --- a/tyrant_optimize.cpp +++ b/tyrant_optimize.cpp @@ -1754,6 +1754,7 @@ void print_available_effects() " Cold-Sleep\n" " Iron-Will\n" " Unity\n" + " Devotion\n" ; } void usage(int argc, char** argv)