Skip to content

Commit

Permalink
Fix #7: Ornate Mirror no longer applies permanent negative strength i…
Browse files Browse the repository at this point in the history
…f you use Dark Shackles
  • Loading branch information
twanvl committed Jan 10, 2019
1 parent 130ab26 commit c629ab9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### v1.5.5
* Fix: Glowing Rock end of turn status card interaction
* Fix: Make Echo Draught stack correctly
* Fix: Ornate Mirror no longer applies permanent negative strength if you use Dark Shackles

### v1.5.4
* Fix crash with Treasure Map and Replay the Spire's portal rooms
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/conspire/monsters/OrnateMirror.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.megacrit.cardcrawl.monsters.EnemyMoveInfo;
import com.megacrit.cardcrawl.powers.AbstractPower;
import com.megacrit.cardcrawl.powers.DexterityPower;
import com.megacrit.cardcrawl.powers.GainStrengthPower;
import com.megacrit.cardcrawl.powers.LoseDexterityPower;
import com.megacrit.cardcrawl.powers.LoseStrengthPower;
import com.megacrit.cardcrawl.powers.StrengthPower;
Expand Down Expand Up @@ -71,9 +72,9 @@ public class OrnateMirror extends AbstractMonster {
// moves done
private boolean doneReflect;
// buffs/debuffs to copy
private int copy_str = 0, copy_dex = 0, copy_weak = 0, copy_vuln = 0, copy_negstr = 0;
private int copy_str = 0, copy_dex = 0, copy_weak = 0, copy_vuln = 0, copy_negstr = 0, copy_gainstr = 0;
// buffs/debuffs to apply
private int apply_str = 0, apply_dex = 0, apply_weak = 0, apply_vuln = 0, apply_negstr = 0;
private int apply_str = 0, apply_dex = 0, apply_weak = 0, apply_vuln = 0, apply_negstr = 0, apply_gainstr = 0;

public OrnateMirror() {
this(-210.f,0.f);
Expand Down Expand Up @@ -146,6 +147,9 @@ public void takeTurn() {
if (apply_negstr > 0) {
AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(AbstractDungeon.player, this, new StrengthPower(AbstractDungeon.player, -apply_negstr), -apply_negstr));
}
if (apply_gainstr > 0) {
AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(AbstractDungeon.player, this, new GainStrengthPower(AbstractDungeon.player, apply_gainstr), apply_gainstr));
}
AbstractDungeon.actionManager.addToBottom(new GainBlockAction(this, this, this.blockAmt));
break;
}
Expand All @@ -171,6 +175,7 @@ public void onApplyPower(AbstractPower powerToApply, AbstractCreature target, Ab
// For reflecting powers
if (source == null || !source.isPlayer) return;
if (target == this && powerToApply instanceof StrengthPower && powerToApply.amount < 0) copy_negstr += -powerToApply.amount;
if (target == this && powerToApply instanceof GainStrengthPower && powerToApply.amount > 0) copy_gainstr += powerToApply.amount;
if (target == this && powerToApply instanceof WeakPower && powerToApply.amount > 0) copy_weak += powerToApply.amount;
if (target == this && powerToApply instanceof VulnerablePower && powerToApply.amount > 0) copy_vuln += powerToApply.amount;
if (target.isPlayer && powerToApply instanceof StrengthPower && powerToApply.amount > 0) copy_str += powerToApply.amount;
Expand All @@ -192,6 +197,7 @@ public void calculateCopyPowers() {
apply_weak = copy_weak * 2 / 3;
apply_vuln = copy_vuln * 2 / 3;
apply_negstr = copy_negstr * 2 / 3;
apply_gainstr = Math.min(apply_negstr, copy_gainstr * 2 / 3);
apply_str = Math.max(0, Math.min(MAX_STR, copy_str * 2 / 3));
apply_dex = Math.max(0, Math.min(MAX_STR, copy_dex * 2 / 3));
}
Expand All @@ -218,7 +224,7 @@ protected void getMove(int num) {
}
EnemyMoveInfo move = moves.pickRandomMove(this);
if (move.nextMove == COPY_POWER) {
copy_str = copy_dex = copy_weak = copy_vuln = copy_negstr = 0;
copy_str = copy_dex = copy_weak = copy_vuln = copy_negstr = copy_gainstr = 0;
}
}

Expand Down

0 comments on commit c629ab9

Please sign in to comment.