Skip to content

Commit

Permalink
Sun Blade
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Jul 6, 2024
1 parent 711d9c6 commit 5f539dc
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/cards.csv
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,10 @@
7625|Ferro Golem|6|4|2|6|7|4|1:10=drawequip|golem
5626|Wicked Shield|6|1|2|2||4|1:11=wicked+turnstart=resetdr|
7626|Wicked Shield|6|1|2|3||4|1:11=wicked+turnstart=halvedr|
5627|Sun Blade|6|0|3|1|3|2|2:10=heatstroke|
7627|Sun Blade|6|0|3|2|5|4|2:10=heatstroke|
5627|Sun Blade|6|0|3|2|3|2|1:10=heatstroke+hit=heatstroke+death=miragetax|
7627|Sun Blade|6|0|3|3|5|4|1:10=heatstroke+hit=heatstroke+death=miragemill|
5628|Mirage|6|4|1|0|2|8|prespell=mirage|token
7628|Mirage|6|4|1|0|2|8|prespell=mirage|token
5630|Shard of Bravery|6|3|3|2|||bravery|
7630|Shard of Bravery|6|3|3|1|||bravery|
5650|Fire Pendulum|6|2|0|0|||pend|pillar+stackable+additive+charges=1
Expand Down
57 changes: 56 additions & 1 deletion src/rs/src/skill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ pub enum Skill {
millpillar,
mimic,
miracle,
mirage,
miragetax,
miragemill,
mist,
mitosis,
mitosisspell,
Expand Down Expand Up @@ -1110,6 +1113,9 @@ impl<'a> Display for SkillName<'a> {
Skill::millpillar => f.write_str("millpillar"),
Skill::mimic => f.write_str("mimic"),
Skill::miracle => Ok(()),
Skill::mirage => f.write_str("mirage"),
Skill::miragetax => Ok(()),
Skill::miragemill => Ok(()),
Skill::mist => f.write_str("mist"),
Skill::mitosis => f.write_str("mitosis"),
Skill::mitosisspell => Ok(()),
Expand Down Expand Up @@ -1677,7 +1683,11 @@ impl Skill {
}
}
Skill::throwfeather => {}
Skill::heatstroke => {}
Skill::heatstroke => {
let foe = ctx.get_foe(ctx.get_owner(c));
let mirage = ctx.new_thing(card::As(ctx.get(c, Stat::card), card::Mirage), foe);
ctx.addCrea(foe, mirage);
}
Skill::grab2h => {}
Skill::protect => {}
Skill::fish => {
Expand Down Expand Up @@ -3602,6 +3612,51 @@ impl Skill {
ctx.set(owner, Stat::hp, 1);
}
}
Self::mirage => {
let tgt = data.tgt;
let owner = ctx.get_owner(c);
if tgt != 0
&& owner == ctx.get_owner(t)
&& owner == ctx.get_owner(tgt)
&& ctx.get(c, Stat::frozen) == 0
&& ctx.get(c, Stat::delayed) == 0
&& data
.active
.and_then(|sk| sk.targeting(ctx.cardset()))
.map(|tgt| tgt.check(ctx, t, c))
.unwrap_or(false)
{
if !ctx.hasskill(tgt, Event::Prespell, Skill::mirage) {
data.tgt = c;
} else {
let totaldw = ctx
.get_player(owner)
.creatures
.into_iter()
.map(|cr| {
(cr != 0 && ctx.hasskill(cr, Event::Prespell, Skill::mirage)) as u32
})
.sum::<u32>();
if totaldw > 0 && ctx.upto(totaldw) == 0 {
data.tgt = c;
}
}
}
}
Self::miragetax => {
if card::IsOf(ctx.get(t, Stat::card), card::Mirage) {
for q in ctx.get_player_mut(ctx.get_owner(t)).quanta.iter_mut() {
if *q > 1 {
*q -= 1;
}
}
}
}
Self::miragemill => {
if card::IsOf(ctx.get(t, Stat::card), card::Mirage) {
ctx.mill(ctx.get_owner(t), 1)
}
}
Self::mist => {
for _ in 0..ctx.get(c, Stat::charges) {
if ctx.upto(20) == 0 {
Expand Down

0 comments on commit 5f539dc

Please sign in to comment.