Skip to content

Commit

Permalink
Merge pull request #53 from elysiumplain/bugfix
Browse files Browse the repository at this point in the history
Code cleanup & fix text for Embezzle & Shard of Focus
  • Loading branch information
serprex authored Dec 30, 2023
2 parents 0fb65bc + 67170bd commit 751c262
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
6 changes: 6 additions & 0 deletions src/rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,12 @@ mod test {
Skill::steal.proc(&mut ctx, p2, bw, &mut ProcData::default());
assert_eq!(ctx.get_shield(p1), 0);
assert_eq!(ctx.get(ctx.get_shield(p2), Stat::charges), 1);
// check against non-stacking duplicable permanent
let epi1 = ctx.new_thing(card::Epidemic, p1);
let epi2 = ctx.new_thing(card::Epidemic, p1);
Skill::steal.proc(&mut ctx, p2, epi2, &mut ProcData::default());
assert_eq!(ctx.get_owner(epi2), p2);
assert_eq!(ctx.get_owner(epi1), p1);
}

#[test]
Expand Down
19 changes: 6 additions & 13 deletions src/rs/src/skill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,20 +1554,16 @@ impl Skill {
if ctx.get_kind(t) != Kind::Player {
Skill::destroy.proc(ctx, c, t, data);
}
let is_open = ctx.cardset() == CardSet::Open;
ctx.buffhp(c, 15);
if ctx.truehp(c) > 45 {
let is_open = ctx.cardset() == CardSet::Open;
let owner = ctx.get_owner(c);
let card = ctx.get(c, Stat::card);
if is_open {
ctx.remove(c);
} else {
ctx.die(c);
}
ctx.transform(
c,
card::As(card, if is_open { card::BlackHole } else { card::v_BlackHole }),
);
ctx.transform(c, card::As(ctx.get(c, Stat::card), if is_open { card::BlackHole } else { card::v_BlackHole }));
ctx.addCard(owner, c);
}
}
Expand Down Expand Up @@ -4330,13 +4326,10 @@ impl Skill {
t
};
ctx.set(t, Stat::casts, 0);
let kind = ctx.get_kind(t);
if kind == Kind::Permanent {
ctx.addPerm(owner, t);
} else if kind == Kind::Weapon {
ctx.setWeapon(owner, t);
} else {
ctx.setShield(owner, t);
match ctx.get_kind(t) {
Kind::Permanent => ctx.addPerm(owner, t),
Kind::Weapon => ctx.setWeapon(owner, t),
_ => ctx.setShield(owner, t),
}
}
Self::steam => {
Expand Down
4 changes: 2 additions & 2 deletions src/rs/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl<'a> SkillThing<'a> {
Cow::from(s)
}
Skill::accretion => Cow::from(if self.set() == CardSet::Open {
"Destroy target permanent & gain 0|10. If using this ability leaves this creature at more than 30HP, transform into a black hole in your hand"
"Destroy target permanent & gain 0|15. If using this ability leaves this creature at more than 45HP, transform into a black hole in your hand"
} else {
"Destroy target permanent & gain 0|15. If using this ability leaves this creature at more than 45HP, destroy this creature & add a black hole to your hand"
}),
Expand Down Expand Up @@ -317,7 +317,7 @@ impl<'a> SkillThing<'a> {
Skill::embezzle =>
Cow::from("Replaces target creature's skills with \"When this creature damages a player, that player draws a card. When this creature dies, destroy top card of opponent's deck"),
Skill::embezzledeath =>
Cow::from("When this creature dies, destroy top two cards of opponent's deck"),
Cow::from("When this creature dies, destroy top card of opponent's deck"),
Skill::empathy =>
Cow::from(if self.set() == CardSet::Open {
"At the end of your turn, heal 1 for each creature you own. For every 8 creatures you own (rounded down), pay 1:0 at the end of your turn"
Expand Down

0 comments on commit 751c262

Please sign in to comment.