Skip to content

Commit

Permalink
imbue: not additive
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Sep 20, 2024
1 parent ecc4566 commit f2518cb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 43 deletions.
80 changes: 37 additions & 43 deletions src/rs/src/skill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3121,57 +3121,51 @@ impl Skill {
Self::imbue => {
let isweap = ctx.get_card(ctx.get(t, Stat::card)).kind == Kind::Weapon;
let pl = ctx.get_player(ctx.get_owner(t));
let equip = if isweap {
pl.weapon
} else {
pl.shield
};
let equip = if isweap { pl.weapon } else { pl.shield };
ctx.die(t);
if equip == 0 {
return;
}
ctx.die(t);
ctx.unsummon(equip);
ctx.fx(t, Fx::Endow);
let tgt = ctx.get_thing(t);
let tstatus = tgt.status.clone();
let mut setcast = false;
{
let newskill = tgt.skill.clone();
let tflag = tgt.flag.0;
let mut sader = ctx.get_thing_mut(equip);
for (nk, nv) in newskill.into_iter() {
match sader.skill.entry(nk) {
SkillsEntry::Occupied(sk) => {
if nk == Event::Cast {
continue
}
sk.into_mut().extend(nv.as_ref());
}
SkillsEntry::Vacant(sk) => {
if nk == Event::Cast {
setcast = true;
}
sk.insert(nv);
}
ctx.unsummon(equip);
ctx.fx(t, Fx::Endow);
let tgt = ctx.get_thing(t);
let tstatus = tgt.status.clone();
let mut setcast = false;
{
let newskill = tgt.skill.clone();
let tflag = tgt.flag.0;
let mut sader = ctx.get_thing_mut(equip);
for (nk, nv) in newskill.into_iter() {
match sader.skill.entry(nk) {
SkillsEntry::Occupied(sk) => {
if nk == Event::Cast {
continue;
}
sk.into_mut().extend(nv.as_ref());
}
SkillsEntry::Vacant(sk) => {
if nk == Event::Cast {
setcast = true;
}
sk.insert(nv);
}
sader.flag.0 |= tflag;
}
for &(k, v) in tstatus.iter() {
match k {
Stat::hp
| Stat::maxhp
| Stat::atk
| Stat::card
| Stat::costele => (),
Stat::castele
| Stat::cast => if setcast {
ctx.set(equip, k, v)
},
Stat::adrenaline => ctx.set(equip, k, v),
_ => ctx.incrStatus(equip, k, v),
}
sader.flag.0 |= tflag;
sader.flag.0 &= !Flag::additive;
}
for &(k, v) in tstatus.iter() {
match k {
Stat::hp | Stat::maxhp | Stat::atk | Stat::card | Stat::costele => (),
Stat::castele | Stat::cast => {
if setcast {
ctx.set(equip, k, v)
}
}
Stat::adrenaline => ctx.set(equip, k, v),
_ => ctx.incrStatus(equip, k, v),
}
}
}
Self::immolate(x) => {
ctx.die(t);
Expand Down
1 change: 1 addition & 0 deletions src/rs/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ impl<'a> SkillThing<'a> {
Skill::ignite =>
Cow::from("Deal 20 spell damage to opponent. Deal 1 spell damage to each creature"),
Skill::ignitediscard => Cow::from("When discarded, deal 5 spell damage to opponent"),
Skill::imbue => Cow::from("Discard target equipment card. Imbue on equipped equipment. Return imbued equipment to hand. Imbued equipment is not additive"),
Skill::immolate(x) =>
Cow::from(format!("Sacrifice creature you control. Gain {}:6 plus 1 quanta of each other element", x+1)),
Skill::improve =>
Expand Down

0 comments on commit f2518cb

Please sign in to comment.