diff --git a/src/rs/server/src/svg/card.rs b/src/rs/server/src/svg/card.rs index 9ef8927c..18fc2991 100644 --- a/src/rs/server/src/svg/card.rs +++ b/src/rs/server/src/svg/card.rs @@ -75,7 +75,47 @@ pub fn card(code: i32) -> Option { )) }); result.push_str(".webp' style='position:absolute;top:-130px;left:0px'/>"); - result.push_str(&etg::text::rawCardText(cards, card).replace('&', "&")); + let mut text = etg::text::rawCardText(cards, card).replace('&', "&"); + let colons = text.rmatch_indices(':').map(|m| m.0).collect::>(); + for colon_idx in colons { + let start = if matches!(text.as_bytes().get(colon_idx - 1), Some(b'0'..=b'9')) { + if matches!(text.as_bytes().get(colon_idx - 2), Some(b'0'..=b'9')) { + colon_idx - 2 + } else { + colon_idx - 1 + } + } else { + continue; + }; + let end = if matches!(text.as_bytes().get(colon_idx + 1), Some(b'0'..=b'9')) { + if matches!(text.as_bytes().get(colon_idx + 2), Some(b'0'..=b'2')) { + colon_idx + 2 + } else { + colon_idx + 1 + } + } else { + continue; + }; + let num = text[start..colon_idx].parse::().unwrap(); + let ele = text[colon_idx + 1..=end].parse::().unwrap(); + let end = if text.as_bytes().get(end + 1) == Some(&b' ') { + end + 1 + } else { + end + }; + match num { + 0 => text.replace_range(start..=end, "0"), + 1 | 2 | 3 => text.replace_range( + start..=end, + &format!("", ele).repeat(num as usize), + ), + _ => text.replace_range( + start..=end, + &format!("{}", num, ele), + ), + } + } + result.push_str(&text); if card.rarity != 0 { write!( result, diff --git a/src/rs/src/text.rs b/src/rs/src/text.rs index 07cb0396..b6de2de3 100644 --- a/src/rs/src/text.rs +++ b/src/rs/src/text.rs @@ -511,8 +511,11 @@ impl<'a> SkillThing<'a> { Cow::from("Until your next turn, the next spell any player casts is nullified. If this ability nullifies a spell, this creature gains 1|1"), Skill::nymph => Cow::from("Transform target pillar, pendulum, or tower into a Nymph matching target's element"), - Skill::obsession => - Cow::from("When discarded, its owner receives ${c.upped ? 13 : 10} spell damage"), + Skill::obsession => Cow::from(if self.upped() { + "When discarded, its owner receives 13 spell damage" + } else { + "When discarded, its owner receives 10 spell damage" + }), Skill::ouija => Cow::from("Whenever a creature dies, add an Ouija Essence to opponent's hand"), Skill::ouijadestroy => Cow::from("When destroyed, add 1 to opponent's maximum health"), Skill::ouijagrowth => Cow::from("Summon an Ouija Essence on opponent's side of the field"),