From 2d4c988f4f961c794a44012dfb5c21fe11edf0f0 Mon Sep 17 00:00:00 2001 From: Alexander Puck Neuwirth Date: Tue, 11 Jul 2023 22:33:26 +0200 Subject: [PATCH] add boilerplate changes (#65) --- CHANGELOG.md | 17 +++++++++++------ sim.cpp | 24 +++++++++++++++++++++--- tyrant_optimize.cpp | 6 +++--- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85c8d485..d78d57f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [6.5.0] - 2023-07-11 + +- Update corrosive skill +- Added options `update-corrosive-protect-armor` and `no-update-corrosive-protect-armor` to toggle new behaviour (default: updated) + ## [6.4.0] - 2023-04-14 - Updated `strict-db` to discard the database. This is now the default behavior for tuo. @@ -27,9 +32,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [6.2.0] - 2023-04-07 - Update counter skill -- Added options `update-counter-without-damage` and `no-update-counter-without-damage` to toggle new behaviour +- Added options `update-counter-without-damage` and `no-update-counter-without-damage` to toggle new behaviour (default: updated) - Update poison skill -- Added options `update-poison-after-attacked` and `no-update-poison-after-attacked` to toggle new behaviour +- Added options `update-poison-after-attacked` and `no-update-poison-after-attacked` to toggle new behaviour (default: updated) ## [6.1.0] - 2023-04-04 @@ -38,7 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [4.8.0] - 2023-04-04 - Update subdue skill -- Added options `update-subdue-before-attack` and `no-update-subdue-before-attack` to toggle new behaviour +- Added options `update-subdue-before-attack` and `no-update-subdue-before-attack` to toggle new behaviour (default: updated) - Changed order of operations on an attack to: Flying Subdue @@ -53,17 +58,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [4.7.0] - 2023-04-02 - Update leech skill -- Added options `update-leech-increase-max-hp` and `no-update-leech-increase-max-hp` to toggle new behaviour +- Added options `update-leech-increase-max-hp` and `no-update-leech-increase-max-hp` to toggle new behaviour (default: updated) ## [4.6.0] - 2023-04-02 - Update mimic skill -- Added options `update-dont-evade-mimic-selection` and `no-update-dont-evade-mimic-selection` to toggle new behaviour +- Added options `update-dont-evade-mimic-selection` and `no-update-dont-evade-mimic-selection` to toggle new behaviour (default: updated) ## [4.5.0] - 2023-04-02 - Update barrier skill -- Added options `update-barrier-each-turn` and `no-update-barrier-each-turn` to toggle new behaviour +- Added options `update-barrier-each-turn` and `no-update-barrier-each-turn` to toggle new behaviour (default: updated) ## [6.0.0] - 2023-04-02 diff --git a/sim.cpp b/sim.cpp index 2447baa4..6308bb02 100644 --- a/sim.cpp +++ b/sim.cpp @@ -1628,7 +1628,7 @@ struct PerformAttack { perform_counter(fd, att_status, def_status); } - if (is_alive(att_status) && att_dmg) + if (is_alive(att_status) && (__builtin_expect(fd->fixes[Fix::corrosive_protect_armor],true) ||att_dmg )) { perform_corrosive(fd, att_status, def_status); } @@ -1786,7 +1786,7 @@ struct PerformAttack #ifndef NDEBUG std::string reduced_desc; #endif - unsigned reduced_dmg(0); + unsigned reduced_dmg(0); // damage reduced by armor, protect and in turn again canceled by pierce, etc. unsigned armor_value = 0; // Armor if (def_status->m_card->m_type == CardType::assault) { @@ -1816,7 +1816,7 @@ struct PerformAttack #endif reduced_dmg += def_status->protected_value(); } - unsigned pierce_value = att_status->skill(Skill::pierce) + att_status->skill(Skill::rupture); + unsigned pierce_value = att_status->skill(Skill::pierce); if (reduced_dmg > 0 && pierce_value > 0) { #ifndef NDEBUG @@ -1824,6 +1824,24 @@ struct PerformAttack #endif reduced_dmg = safe_minus(reduced_dmg, pierce_value); } + unsigned rupture_value = att_status->skill(Skill::rupture); + if (reduced_dmg > 0 && rupture_value > 0) + { +#ifndef NDEBUG + if (debug_print > 0) { reduced_desc += "-" + tuo::to_string(rupture_value) + "(rupture)"; } +#endif + reduced_dmg = safe_minus(reduced_dmg, rupture_value); + } + if(__builtin_expect(fd->fixes[Fix::corrosive_protect_armor],true)) { + unsigned corrosive_value = def_status->m_corroded_rate; + if (reduced_dmg > 0 && corrosive_value > 0) + { +#ifndef NDEBUG + if (debug_print > 0) { reduced_desc += "-" + tuo::to_string(corrosive_value) + "(corrosive)"; } +#endif + reduced_dmg = safe_minus(reduced_dmg, corrosive_value); + } + } att_dmg = safe_minus(att_dmg, reduced_dmg); #ifndef NDEBUG if (debug_print > 0) diff --git a/tyrant_optimize.cpp b/tyrant_optimize.cpp index f1a97d57..52f27f09 100644 --- a/tyrant_optimize.cpp +++ b/tyrant_optimize.cpp @@ -468,7 +468,7 @@ void init() fixes[Fix::revenge_on_death] = true; fixes[Fix::death_from_bge] = true; fixes[Fix::legion_under_mega] = true; - + // Sort of a misnomer, but updated skills are also treated as fixes fixes[Fix::barrier_each_turn] = true; fixes[Fix::dont_evade_mimic_selection] = true; fixes[Fix::leech_increase_max_hp] = true; @@ -476,7 +476,7 @@ void init() fixes[Fix::counter_without_damage] = true; fixes[Fix::poison_after_attacked] = true; - fixes[Fix::corrosive_protect_armor] = false; + fixes[Fix::corrosive_protect_armor] = true; db_limit = -1; @@ -3024,7 +3024,7 @@ DeckResults run(int argc, const char **argv) { fixes[Fix::legion_under_mega] = true; } - else if (strcmp(argv[argIndex], "update-barrier-each-turn") == 0) + else if (strcmp(argv[argIndex], "update-barrier-each-turn") == 0) { fixes[Fix::barrier_each_turn] = true; }