Skip to content

Commit

Permalink
Nerf corpse explosion, fix 0hp creatures not dying to damage, slight …
Browse files Browse the repository at this point in the history
…gradient on unshiny cards
  • Loading branch information
serprex committed Feb 21, 2024
1 parent 0207521 commit c85666b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 24 deletions.
11 changes: 4 additions & 7 deletions src/Components/CardImage.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { maybeLightenStr, strcols } from '../ui.js';
import { gradientStr, maybeLightenStr } from '../ui.js';

export default function CardImage(props) {
const bgcol = () => maybeLightenStr(props.card);
Expand All @@ -10,12 +10,9 @@ export default function CardImage(props) {
onClick={props.onClick}
onContextMenu={props.onContextMenu}
style={{
background:
props.card.shiny ?
`linear-gradient(90deg,${bgcol()},${bgcol()} 66%,${
strcols[props.card.element + !props.card.upped * 13]
})`
: bgcol(),
'background-image': `linear-gradient(60deg,${bgcol()},${bgcol()} 75%,${gradientStr(
props.card,
)})`,
color: props.card.upped ? '#000' : '#fff',
...props.style,
}}>
Expand Down
25 changes: 12 additions & 13 deletions src/rs/src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@ impl Game {
dmgdata.dmg = dmg;
dmgdata.amt = capdmg;
self.proc_data(Event::Dmg, id, &mut dmgdata);
if realdmg > 0 {
if dmg > 0 {
if (!dontdie || kind == Kind::Player) && self.truehp(id) <= 0 {
self.die(id);
} else if self.get(id, Flag::voodoo) {
Expand Down Expand Up @@ -2155,20 +2155,19 @@ impl Game {
}

pub fn poison(&mut self, mut id: i16, amt: i16) {
if self.get_kind(id) == Kind::Weapon {
id = self.get_owner(id);
}
let ownpoison = self.getSkill(id, Event::OwnPoison);
let mut data = ProcData::default();
data.amt = amt;
self.trigger_data(Event::OwnPoison, id, 0, &mut data);
let amt = data.amt;
if data.amt != 0 {
self.incrStatus(id, Stat::poison, amt);
if amt > 0 {
if amt != 0 {
if self.get_kind(id) == Kind::Weapon {
id = self.get_owner(id);
}
let ownpoison = self.getSkill(id, Event::OwnPoison);
let mut data = ProcData::default();
data.amt = amt;
self.trigger_data(Event::OwnPoison, id, 0, &mut data);
if data.amt > 0 {
self.incrStatus(id, Stat::poison, data.amt);
self.fx(id, Fx::Sfx(Sfx::poison));
if self.get(id, Flag::voodoo) {
self.poison(self.get_foe(self.get_owner(id)), amt);
self.poison(self.get_foe(self.get_owner(id)), data.amt);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/rs/src/skill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1937,7 +1937,7 @@ impl Skill {
ctx.die(t);
let owner = ctx.get_owner(c);
let foe = ctx.get_foe(owner);
let poison = ctx.get(t, Stat::poison) + ctx.get(t, Flag::poisonous) as i16;
let poison = ctx.get(t, Flag::poisonous) as i16 + (ctx.get(t, Stat::poison) > 0) as i16;
ctx.masscc(foe, if card::Upped(ctx.get(c, Stat::card)) { 0 } else { owner }, |ctx, cr| {
if cr != t {
ctx.spelldmg(cr, dmg);
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 @@ -241,9 +241,9 @@ impl<'a> SkillThing<'a> {
Cow::from("Remove statuses (positive & negative) from target creature or permanent, & heal target creature 1"),
Skill::cold => Cow::from("\u{2153} chance to freeze non-ranged attackers for 3 turns"),
Skill::corpseexplosion => Cow::from(if self.upped() {
"Sacrifice one of your creatures to deal 1 spell damage to all enemy creatures. Increase damage by 1 for every 8HP of the sacrifice. Poisonous sacrifices poison. Also affect opponent"
"Sacrifice one of your creatures to deal 1 spell damage to all enemy creatures. Increase damage by 1 for every 8HP of the sacrifice. Poisonous sacrifices poison. Poisoned sacrifices poison. Also affect opponent"
} else {
"Sacrifice one of your creatures to deal 1 spell damage to all other creatures. Increase damage by 1 for every 8HP of the sacrifice. Poisonous sacrifices poison. Also affect opponent"
"Sacrifice one of your creatures to deal 1 spell damage to all other creatures. Increase damage by 1 for every 8HP of the sacrifice. Poisonous sacrifices poison. Poisoned sacrifices poison. Also affect opponent"
}),
Skill::counter =>
Cow::from("When this creature is attacked by another creature, if this creature is able to attack, it deals its damage to the attacking creature"),
Expand Down
18 changes: 18 additions & 0 deletions src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ export const strcols = [
export function maybeLightenStr(card) {
return strcols[card.element + card.upped * 13];
}
const avgcols = [];
for (let i = 0; i < 13; i++) {
const s1 = strcols[i],
s2 = strcols[i + 13];
let c = '#';
for (let j = 1; j <= 3; j++) {
c += Math.round(
Math.sqrt((parseInt(s1[j], 16) ** 2 + parseInt(s2[j], 16) ** 2) / 2),
).toString(16);
}
avgcols.push(c);
}
export function gradientStr(card) {
return card.shiny ?
strcols[card.element + !card.upped * 13]
: avgcols[card.element];
}

export const presets = [
[
'No Shop',
Expand Down
2 changes: 1 addition & 1 deletion src/views/Shop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export default function Shop() {
}}
/>
{rx.user.freepacks && rx.user.freepacks[n()] > 0 && (
<span style="text-align:center;width:20px;border-radius:50%;background:#a31;position:absolute;font-weight:bold;top:-5px;left: 145px">
<span style="text-align:center;width:20px;border-radius:50%;background-color:#a31;position:absolute;font-weight:bold;top:-5px;left: 145px">
{rx.user.freepacks[n()]}
</span>
)}
Expand Down

0 comments on commit c85666b

Please sign in to comment.