Skip to content

Commit

Permalink
Support BGE SuperHeroism
Browse files Browse the repository at this point in the history
  • Loading branch information
APN-Pucky committed May 11, 2019
1 parent 36f2591 commit a0793e6
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 10 deletions.
Binary file modified SimpleTUOptimizeStarter-x86.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions SimpleTUOptimizeStarter.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FileDelete, %file%

MaxCardsSections := 100

BGEffects := "none|Crackdown|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"
BGEffects := "none|SuperHeroism|Crackdown|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"

Expand Down Expand Up @@ -119,7 +119,7 @@ Gui, Add, Checkbox, vCommander Checked%IniCommander%, Commander lock
Gui, Add, Edit, vSimOptions r1 xs w600, %IniSimOptions%
Gui, Add, Button, default r2 w100 x100 y+15 section, Simulate
Gui, Add, Checkbox, vx86 Checked%Inix86%, x86 (32-bit)
Gui, Add, Checkbox, vopenmp Checked%IniOpenMP%, openmp
Gui, Add, Checkbox, vopenmp Checked%IniOpenMP%, openmp
Gui, Add, Button, r2 w100 ys xs+200, Exit
Gui, Add, Checkbox, vdebug Checked%IniDebug%, debug
Gui, Add, Checkbox, vtime Checked%IniTime%, time
Expand Down
Binary file modified SimpleTUOptimizeStarter.exe
Binary file not shown.
12 changes: 12 additions & 0 deletions sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tyrant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", };
Expand Down
2 changes: 1 addition & 1 deletion tyrant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tyrant_optimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1140,7 +1140,7 @@ class Process
for(unsigned i =0; i < c_num_threads;++i)
omp_destroy_lock(&locks[i]);
}


static std::vector<Results<uint64_t>> merge(std::vector<Results<uint64_t>> out, std::vector<Results<uint64_t>> in)
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -3565,7 +3566,6 @@ FinalResults<long double> 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;
}
Expand Down

0 comments on commit a0793e6

Please sign in to comment.