Skip to content

Commit

Permalink
Merge Strategy into Merged
Browse files Browse the repository at this point in the history
  • Loading branch information
APN-Pucky committed Sep 5, 2018
2 parents 7866600 + 5ae0751 commit 117e625
Show file tree
Hide file tree
Showing 18 changed files with 88 additions and 36 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ data/ownedcards.txt
out.txt
*.cmd
*.dat

*.out
tuo.exe
*.ini
*.swp
*.stackdump
build-*
tuo-debug.exe
tuo-x86-debug.exe
tuo-x86.exe
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ matrix:
dist: trusty
sudo: required
compiler: gcc

before_install:
- TUO_TARGET="${TUO_PLATFORM::${#TUO_PLATFORM}-2}"
- "./build/${TUO_TARGET}/requirements.sh"

install:
- source ./build/${TUO_TARGET}/build.sh
script:
Expand All @@ -30,6 +30,7 @@ deploy:
secure: vKTCOsNwCpSzB2buiNSroCvhAR5xHv86L7YDa09A3Y4oZ/grFmcARQKFkjG/zJif+4gpHmrscUJIC4Ru9900QQSVP/mUh5NizPFpoQHHQBbRPOFoor0W0lSXhsFMA154sHICDQ7ZZhZbF8s804VL+JsmAblFqJ0XWNtLD9f0ElklEIELYdhVGDipXhWnIqA3TfG6ztm9KjMXZ3pfPRMf/l4D0t7ISHfzfX07O257ppH83DAEs1aJElG3kxDJiEWoi6k9fq7SIYXbFhmwj6aM3K//qj9ZxIhFwRLaEb8l2zOXj3hNtDGGg99P5Dz7UeDy7l/+eWOgIMBJLe1Ck9AbIYivnOychYxVn/wp56SbbaT1ZsNbgLQxygqc0/btfi2lrT9c0T6db+A9LSGOWvGk3n1pOPOMNE3wvOk7dhLfbA2azFDMoPswW7Hvad0ZQYkBg1TJK7gmChb5FYQtypZzA0CzJaw+r1z7d4a7mF7cAkZmGuM+/BbdmsX9AxYcazJAvsxgHmLnFSunKsw0B3kQ6l9DJmli7w4qi4kdjHGpxQCQ6ocqHmDMvFa85ejhvPjJDvYdyxltC1d5Jq+jxFL91d+2ZMGYdgptR05I0Dc9ApUcItv7NNbY8fNPWJT7AXAlY999bRt9Rz//JvSHUHstn5cc1s0ee6NGRTmiD5oAkuc=
file:
- SimpleTUOptimizeStarter.exe
- SimpleTUOptimizeStarter-x86.exe
- "${TUO_FILE_32}"
- "${TUO_FILE_32_DEBUG}"
- "${TUO_FILE_64}"
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ file(GLOB TUO_SOURCES "*.cpp")
enable_language(CXX)
add_executable(tuo ${TUO_SOURCES})

find_package(Boost EXACT COMPONENTS system thread filesystem regex REQUIRED)
find_package(Boost EXACT COMPONENTS system thread filesystem regex timer REQUIRED)

target_link_libraries(tuo ${Boost_LIBRARIES})

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ ${warning "VERSION is not set (USING NO VERSION instead), use make VERSION=vX.XX
endif
endif

CPPFLAGS := -Wall -Werror -std=gnu++11 -Ofast -DNDEBUG -DNQUEST -DTYRANT_OPTIMIZER_VERSION='"$(VERSION)"'
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex
CPPFLAGS := -Wall -Werror -std=gnu++11 -Ofast -DNDEBUG -DNQUEST -DTYRANT_OPTIMIZER_VERSION='"$(VERSION)"'
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex -lboost_timer

all: $(MAIN)

Expand All @@ -26,4 +26,4 @@ $(MAIN): $(OBJS)
rebuild: clean all

clean:
del /q $(MAIN).exe obj\*.o
del /q $(MAIN) obj\*.o
2 changes: 1 addition & 1 deletion Makefile-debug
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif
endif

CPPFLAGS := -Wall -Werror -std=gnu++11 -Ofast -DTYRANT_OPTIMIZER_VERSION='"$(VERSION)--debug"'
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex -lboost_timer

all: $(MAIN)

Expand Down
2 changes: 1 addition & 1 deletion Makefile-debug.linux
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif
endif

CPPFLAGS := -Wall -Werror -std=gnu++11 -Ofast -g -DTYRANT_OPTIMIZER_VERSION='"$(VERSION)--debug"'
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex -lboost_timer

all: $(MAIN)

Expand Down
2 changes: 1 addition & 1 deletion Makefile-debug.osx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif
endif

CPPFLAGS := -Wall -Werror -std=c++11 -stdlib=libc++ -Ofast -I/usr/local/include -DTYRANT_OPTIMIZER_VERSION='"$(VERSION)--debug"'
LDFLAGS := -L/usr/local/lib -lboost_system-mt -lboost_thread-mt -lboost_filesystem-mt -lboost_regex-mt
LDFLAGS := -L/usr/local/lib -lboost_system-mt -lboost_thread-mt -lboost_filesystem-mt -lboost_regex-mt -lboost_timer-mt

all: $(MAIN)

Expand Down
2 changes: 1 addition & 1 deletion Makefile.intel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif
endif

CPPFLAGS := -Wall -Werror -std=gnu++11 -Ofast -g -DNDEBUG -DNQUEST -DTYRANT_OPTIMIZER_VERSION='"$(VERSION)"' -xHost
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex -lboost_timer

all: $(MAIN)

Expand Down
2 changes: 1 addition & 1 deletion Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif
endif

CPPFLAGS := -Wall -Werror -std=gnu++11 -Ofast -g -DNDEBUG -DNQUEST -DTYRANT_OPTIMIZER_VERSION='"$(VERSION)"'
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex
LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex -lboost_timer

all: $(MAIN)

Expand Down
2 changes: 1 addition & 1 deletion Makefile.osx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif
endif

CPPFLAGS := -Wall -Werror -std=c++11 -stdlib=libc++ -Ofast -I/usr/local/include -DNDEBUG -DNQUEST -DTYRANT_OPTIMIZER_VERSION='"$(VERSION)"'
LDFLAGS := -L/usr/local/lib -lboost_system-mt -lboost_thread-mt -lboost_filesystem-mt -lboost_regex-mt
LDFLAGS := -L/usr/local/lib -lboost_system-mt -lboost_thread-mt -lboost_filesystem-mt -lboost_regex-mt -lboost_timer-mt

all: $(MAIN)

Expand Down
Binary file added SimpleTUOptimizeStarter-x86.exe
Binary file not shown.
14 changes: 9 additions & 5 deletions SimpleTUOptimizeStarter.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ IniRead, IniOrder, %IniFileName%, %IniSection%, Order, 1
IniRead, IniOperation, %IniFileName%, %IniSection%, Operation, 1
IniRead, IniDominion, %IniFileName%, %IniSection%, Dominion, 1
IniRead, IniMono, %IniFileName%, %IniSection%, Mono, 1
IniRead, IniStrategy, %IniFileName%, %IniSection%, Strategy, 1
IniRead, IniCommander, %IniFileName%, %IniSection%, Commander, 0
IniRead, IniEndgame, %IniFileName%, %IniSection%, Endgame, 1
IniRead, IniFund, %IniFileName%, %IniSection%, Fund, 0
Expand All @@ -57,6 +58,7 @@ Gui, Add, Text, r1, Effect:
Gui, Add, Text, r1, Mode:
Gui, Add, Text, r1, Operation:
Gui, Add, Text, r1, Dominion:
Gui, Add, Text, r1, Strategy:
Gui, Add, Text, r1, Flags:

Gui, Add, Edit, vMyDeck ym w600 r5, %IniMyDeck%
Expand Down Expand Up @@ -90,6 +92,7 @@ Gui, Add, ComboBox, vEffect xs Choose%IniEffectNum% section, %BGEffects%
Gui, Add, DDL, altsubmit vMode Choose%IniMode%, Battle / Mission|Battle (defense)|GW|GW (defense)|Brawl|Brawl (defense)|Raid|Campaign|CQ / Surge
Gui, Add, DDL, altsubmit vOperation Group Choose%IniOperation% xs, Climb|Sim|Reorder|Climbex|Anneal|Debug
Gui, Add, DDL, altsubmit vDominion Group Choose%IniDominion% xs, dom-owned|dom-maxed|dom-none
Gui, Add, DDL, altsubmit vStrategy Group Choose%IniStrategy%, none|enfeeble|jam|mortar|siege|strike|sunder|weaken|enhance|evolve|heal|mend|overload|protect|rally|fortify|enrage|entrap|rush|mimic|armor|avenge|scavenge|corrosive|counter|evade|subdue|absorb|flying|payback|revenge|tribute|refresh|wall|barrier|coalition|legion|pierce|rupture|swipe|drain|venom|hunt|berserk|inhibit|sabotage|leech|poison|allegiance|flurry|valor|stasis|summon|bravery

Gui, Add, Text, ys, Endgame:
Gui, Add, Text, r1, Order:
Expand Down Expand Up @@ -159,8 +162,9 @@ selEndgame := (Endgame <= 1 ? "" : "endgame " EndgameVal " ")
selFund := (Fund == "" ? "" : "fund " Fund " ")
selDominion := (Dominion == 3 ? "dom-none " : Dominion == 1 ? "dom-owned " : Dominion == 2 ? "dom-maxed " : "")
selMono := (Mono == 1 ? "" : Mono == 2 ? "-m imperial " : Mono == 3 ? "-m raider " : Mono == 4 ? "-m bloodthirsty " : Mono == 5 ? "-m xeno " : Mono == 6 ? "-m righteous " : Mono == 7 ? "-m progenitor " : "")
selStrategy := (Strategy == 1 ? "" : Strategy == 2 ? "prefered enfeeble " : Strategy == 3 ? "prefered jam " : Strategy == 4 ? "prefered mortar " : Strategy == 5 ? "prefered siege " : Strategy == 6 ? "prefered strike " : Strategy == 7 ? "prefered sunder " : Strategy == 8 ? "prefered weaken " : Strategy == 9 ? "prefered enhance" : Strategy == 10 ? "prefered evolve" : Strategy == 11 ? "prefered heal" : Strategy == 12 ? "prefered mend" : Strategy == 13 ? "prefered overload" : Strategy == 14 ? "prefered protect" : Strategy == 15 ? "prefered rally" : Strategy == 16 ? "prefered fortify" : Strategy == 17 ? "prefered enrage" : Strategy == 18 ? "prefered entrap" : Strategy == 19 ? "prefered rush" : Strategy == 20 ? "prefered mimic" : Strategy == 21 ? "prefered armor" : Strategy == 22 ? "prefered avenge" : Strategy == 23 ? "prefered scavenge" : Strategy == 24 ? "prefered corrosive" : Strategy == 25 ? "prefered evade" : Strategy == 26 ? "prefered subdue" : Strategy == 27 ? "prefered absorb" : Strategy == 28 ? "prefered flying" : Strategy == 29 ? "prefered payback" : Strategy == 30 ? "prefered revenge" : Strategy == 31 ? "prefered tribute" : Strategy == 32 ? "prefered refresh" : Strategy == 33 ? "prefered wall" : Strategy == 34 ? "prefered barrier" : Strategy == 35 ? "prefered coalition" : Strategy == 36 ? "prefered legion" : Strategy == 37 ? "prefered pierce" : Strategy == 38 ? "prefered rupture" : Strategy == 39 ? "prefered swipe" : Strategy == 40 ? "prefered drain" : Strategy == 41 ? "prefered venom" : Strategy == 42 ? "prefered hunt" : Strategy == 43 ? "prefered berserk" : Strategy == 44 ? "prefered inhibit" : Strategy == 45 ? "prefered sabotage" : Strategy == 46 ? "prefered leech" : Strategy == 47 ? "prefered poison" : Strategy == 48 ? "prefered allegiance" : Strategy == 49 ? "prefered allegiance" : Strategy == 50 ? "prefered flurry" : Strategy == 51 ? "prefered valor" : Strategy == 52 ? "prefered stasis" : Strategy == 53 ? "prefered summon" : Strategy == 54 ? "prefered bravery" : "")
selCommander := (Commander ? "-c " : "")
execString = %selTUO% "%MyDeck%" "%EnemiesDeck%" %selMode% %selOrder% %selMySiege%%selEnemySiege%%selVIP%%selQuest%%selEffect%%selThreads%%selEndgame%%selFund%%selSimOptions%%selOperation% %Iterations% %selCommander%%selDominion%%selMono%
execString = %selTUO% "%MyDeck%" "%EnemiesDeck%" %selMode% %selOrder% %selMySiege%%selEnemySiege%%selVIP%%selQuest%%selEffect%%selThreads%%selEndgame%%selFund%%selSimOptions%%selOperation% %Iterations% %selCommander%%selDominion%%selMono%%selStrategy%
Run, cmd.exe /c title TUOptimizeOutput && echo %execString% && %execString% & pause
Gui, Show
return
Expand Down Expand Up @@ -314,6 +318,7 @@ IniWrite, %Operation%, %IniFileName%, %IniSection%, Operation
IniWrite, %Dominion%, %IniFileName%, %IniSection%, Dominion
IniWrite, %Iterations%, %IniFileName%, %IniSection%, Iterations
IniWrite, %Mono%, %IniFileName%, %IniSection%, Mono
IniWrite, %Strategy%, %IniFileName%, %IniSection%, Strategy
IniWrite, %Commander%, %IniFileName%, %IniSection%, Commander
IniWrite, %Threads%, %IniFileName%, %IniSection%, Threads
IniWrite, %SimOptions%, %IniFileName%, %IniSection%, SimOptions
Expand All @@ -331,14 +336,14 @@ while true
}
ExitApp

DownloadCards(url,file) {
DownloadCards(url,file) {
UrlDownloadToFile, *0 %url%, %file%
if ErrorLevel
{
MsgBox, Error downloading %file%.
had_error := true
}
else
}
else
{
FileReadLine,VAR1,%file%,3
If InStr(VAR1, "File Not Found")
Expand All @@ -349,4 +354,3 @@ DownloadCards(url,file) {
}
return 1
}

Binary file modified SimpleTUOptimizeStarter.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions build/windows/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ set -xue

#cp build-dir/tuo.exe $TUO_FILE

export TUO_FILE_ZIP="tuo.${TRAVIS_TAG}_32+64_bit.zip"
export TUO_FILE_ZIP="tuo.${TRAVIS_TAG}_32+64_bit.zip"

#ls -la

zip -r "$TUO_FILE_ZIP" data/ SimpleTUOptimizeStarter.ahk SimpleTUOptimizeStarter.exe "$TUO_FILE_32" "$TUO_FILE_64" "$TUO_FILE_32_DEBUG" "$TUO_FILE_64_DEBUG"
zip -r "$TUO_FILE_ZIP" data/ SimpleTUOptimizeStarter.ahk SimpleTUOptimizeStarter.exe SimpleTUOptimizeStarter-x86.exe "$TUO_FILE_32" "$TUO_FILE_64" "$TUO_FILE_32_DEBUG" "$TUO_FILE_64_DEBUG"



Expand Down
4 changes: 2 additions & 2 deletions card.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class Card
m_set(0),
m_skills(),
m_skills_on_play(),
//APN
m_skills_on_attacked(),
//APN
m_skills_on_attacked(),
m_skills_on_death(),
m_type(CardType::assault),
m_category(CardCategory::normal),
Expand Down
9 changes: 9 additions & 0 deletions cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
export TRAVIS_TAG=TMPDebug
export TUO_PLATFORM=windowsXX
export TUO_FILE_32=tuo-x86.exe
export TUO_FILE_64=tuo.exe
export TUO_FILE_32_DEBUG=tuo-x86-debug.exe
export TUO_FILE_64_DEBUG=tuo-debug.exe
export TUO_TARGET=windows
./build/${TUO_TARGET}/build.sh
19 changes: 10 additions & 9 deletions sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ inline unsigned CardStatus::attack_power() const
signed attack = calc_attack_power();
if(__builtin_expect(attack <0,false))
{
std::cout << m_card->m_name << " " << m_card->m_attack << " " << attack << " " << m_temp_attack_buff << " " << m_corroded_weakened << std::endl;
std::cout << m_card->m_name << " " << m_card->m_attack << " " << attack << " " << m_temp_attack_buff << " " << m_corroded_weakened << std::endl;
}
_DEBUG_ASSERT(attack >= 0);
return (unsigned)attack;
}

inline signed CardStatus::calc_attack_power() const
{
return
return
(signed)safe_minus(
m_card->m_attack + safe_minus(m_perm_attack_buff, m_subdued),
m_corroded_weakened
Expand Down Expand Up @@ -724,7 +724,7 @@ struct PlayCard
{
setStorage<type>();
placeCard<type>();
status->m_summoned = summoned;
status->m_summoned = summoned;

unsigned played_faction_mask(0);
unsigned same_faction_cards_count(0);
Expand Down Expand Up @@ -884,7 +884,7 @@ struct PlayCard
faction_names[card->m_faction].c_str());
}

}
}
//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)
{
Expand Down Expand Up @@ -1128,7 +1128,7 @@ void turn_start_phase(Field* fd)
// Active player's commander card:
cooldown_skills(&fd->tap->commander);
//grab structs before new one get summoned
auto& structures(fd->tap->structures);
auto& structures(fd->tap->structures);
unsigned end(structures.size());
// Active player's assault cards:
// update index
Expand Down Expand Up @@ -1399,6 +1399,7 @@ struct PerformAttack
damage_dependant_pre_oa<def_cardtype>();

on_attacked<def_cardtype>();
if (!is_alive(att_status)) { return att_dmg; }


// Enemy Skill: Counter
Expand Down Expand Up @@ -1714,7 +1715,7 @@ struct PerformAttack
}

template<enum CardType::CardType>
void on_attacked() {
void on_attacked() {
//APN
// resolve On-Attacked skills
for (const auto& ss: def_status->m_card->m_skills_on_attacked)
Expand Down Expand Up @@ -1867,7 +1868,7 @@ bool attack_phase(Field* fd)
unsigned hunt_value = att_status->skill(Skill::hunt);
if(hunt_value)
{
CardStatus* hunted_status{select_first_enemy_assault(fd)};
CardStatus* hunted_status{select_first_enemy_assault(fd)};
if (hunted_status != nullptr)
{
unsigned remaining_dmg = remove_absorption(fd,hunted_status,hunt_value + hunted_status->m_enfeebled);
Expand Down Expand Up @@ -2063,7 +2064,7 @@ inline bool skill_predicate<Skill::weaken>(Field* fd, CardStatus* src, CardStatu
if (__builtin_expect((fd->tapi == src->m_player), true))
{ return is_active_next_turn(dst); }

// APN - On-Attacked/Death don't target the attacking card
// APN - On-Attacked/Death don't target the attacking card

// inactive player performs Weaken (inverted case (on-death activation))
return will_activate_this_turn(dst);
Expand Down Expand Up @@ -2992,7 +2993,7 @@ Results<uint64_t> evaluate_sim_result(Field* fd)
unsigned campaign_score = 100 - 10 * (p[0]->total_nonsummon_cards_destroyed - total_dominions_destroyed);
return {1, 0, 0, (points_score_type)campaign_score};
}
case OptimizationMode::war:
case OptimizationMode::war:
{
unsigned war_score = evaluate_war_score(fd, 0);
return {1,0,0, (points_score_type) war_score};
Expand Down
Loading

0 comments on commit 117e625

Please sign in to comment.