From a0793e64ae94f6cfed80b5cf2ccdff2591adb530 Mon Sep 17 00:00:00 2001 From: APN-Pucky Date: Sat, 11 May 2019 22:49:48 +0200 Subject: [PATCH] Support BGE SuperHeroism --- SimpleTUOptimizeStarter-x86.exe | Bin 724992 -> 724992 bytes SimpleTUOptimizeStarter.ahk | 4 ++-- SimpleTUOptimizeStarter.exe | Bin 1114112 -> 1114112 bytes sim.cpp | 12 ++++++++++++ tyrant.cpp | 2 +- tyrant.h | 2 +- tyrant_optimize.cpp | 12 ++++++------ 7 files changed, 22 insertions(+), 10 deletions(-) diff --git a/SimpleTUOptimizeStarter-x86.exe b/SimpleTUOptimizeStarter-x86.exe index 44d1499dfb6d0fe0b63bba177fa0c8baf14126a4..24f9843eb2c5ca55e66ffd9eeb23ddd9b20ec5e0 100644 GIT binary patch delta 212 zcmZozpwqBGXF~}i)0>%-8=1T(A7q@*_@+6LsXdX25r{!FGZ3=?F)I+W0Wmuea{w{t z_CzMG;PTvBM+Sx`EDT`qqKTWq0LX&zC7QVzM3DG8XnY4Weh3;r1IYiwh%hf@yJ8hr kpC3ZeO=UK+AzSz|m#;O$lF;xHn delta 232 zcmZo@aA|08*|3L^@y_PGjLAT%S&_M2k(m*QnSdC?W&vVWAZ7z%b|B^eVoo6D0%C3; z<^f_}Am#&N{_Tp)0+Z8n3mh33p0F^0!Hr3R3E5fK57E-pX@hynl$*)O>O diff --git a/sim.cpp b/sim.cpp index 22124524..71eb4039 100644 --- a/sim.cpp +++ b/sim.cpp @@ -2605,6 +2605,18 @@ bool check_and_perform_bravery(Field* fd, CardStatus* src) #endif _DEBUG_MSG(1, "%s activates Bravery %u\n", status_description(src).c_str(), bravery_value); src->m_perm_attack_buff += bravery_value; + + //BGE: superheroism + if (__builtin_expect(fd->bg_effects[fd->tapi][PassiveBGE::superheroism], false)) + { + unsigned bge_value = (bravery_value+1) / 2; + const SkillSpec ss_heal{Skill::heal, bge_value, allfactions, 0, 0, Skill::no_skill, Skill::no_skill, true, 0,}; + _DEBUG_MSG(1, "%s activates SuperHeroism: %s\n", status_description(src).c_str(), + skill_description(fd->cards, ss_heal).c_str()); + //fd->skill_queue.emplace(fd->skill_queue.begin()+0, src, ss_heal); + skill_table[Skill::heal](fd,src,ss_heal); //Probably better to perform the skill direct instead of queuing it + } + return true; } return false; diff --git a/tyrant.cpp b/tyrant.cpp index e3694b59..51f3a6ef 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", "Devotion", "Crackdown", + "BloodVengeance", "ColdSleep", "IronWill", "Unity", "Devotion", "Crackdown", "SuperHeroism", }; const std::string cardtype_names[CardType::num_cardtypes]{"Commander", "Assault", "Structure", }; diff --git a/tyrant.h b/tyrant.h index 7107a43c..e0f1cc31 100644 --- a/tyrant.h +++ b/tyrant.h @@ -85,7 +85,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,devotion,crackdown, + bloodvengeance, coldsleep,ironwill,unity,devotion,crackdown,superheroism, // End of BGEs num_passive_bges diff --git a/tyrant_optimize.cpp b/tyrant_optimize.cpp index b1e39dd2..aa84ea76 100644 --- a/tyrant_optimize.cpp +++ b/tyrant_optimize.cpp @@ -1052,7 +1052,7 @@ class Process sim->set_decks(this->your_decks, this->enemy_decks); #pragma omp for reduction(VecPlus:results) schedule(runtime) for(unsigned i =0; i < thread_num_iterations;++i) { - if(results.size()==0) + if(results.size()==0) results =sim->evaluate(); //calculate single sim else { results =merge(results,sim->evaluate()); //calculate single sim @@ -1089,11 +1089,11 @@ class Process const long double sim_accum = std::accumulate(sim->factors.begin(), sim->factors.end(),.0); #pragma omp for reduction(VecPlus:results) schedule(runtime) for(unsigned i =0; i < thread_num_iterations;++i) { -#pragma omp cancellation point for +#pragma omp cancellation point for if(!compare_stop){ - if(results.size()==0) + if(results.size()==0) results =sim->evaluate(); //calculate single sim - else + else results =merge(results,sim->evaluate()); //calculate single sim long double score_accum_d = 0.0; for(unsigned j=0; j < results.size(); ++j) @@ -1140,7 +1140,7 @@ class Process for(unsigned i =0; i < c_num_threads;++i) omp_destroy_lock(&locks[i]); } - + static std::vector> merge(std::vector> out, std::vector> in) { @@ -2746,6 +2746,7 @@ void print_available_effects() " Unity\n" " Devotion\n" " Crackdown\n" + " SuperHeroism\n" ; } bool check_input_amount(int argc, char** argv, int argIndex,int number) @@ -3565,7 +3566,6 @@ FinalResults run(int argc, char** argv) } else if (strcmp(argv[argIndex], "debug") == 0) { - if(check_input_amount(argc,argv,argIndex,1))exit(1); opt_todo.push_back(std::make_tuple(0u, 0u, debug)); opt_num_threads = 1; }