Skip to content

Commit

Permalink
wip, half of skills for weapons implemented, needs targeting logic still
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Jun 30, 2024
1 parent ab6cf10 commit bdad87a
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"url": "https://github.com/serprex/openEtG"
},
"devDependencies": {
"@babel/plugin-syntax-import-attributes": "^7.24.1",
"@babel/plugin-syntax-import-attributes": "^7.24.6",
"@pencil.js/spritesheet": "^1.5.1",
"babel-loader": "^9.1.3",
"babel-preset-solid": "^1.8.17",
Expand Down
10 changes: 5 additions & 5 deletions src/cards.csv
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@
7227|Plague Mask|2|1|2|3||2|buff=poisondr+1:7=doctor|
5228|Frailty|2|3|1|1|||frail|
7228|Frailty|2|3|1|1|||frail2|
5229|Skelton Axe|2|0|3|5|6|3|1=bonesharpen|
7229|Skelton Axe|2|0|3|5|6|3|1=bonesplit|
5229|Skelton Axe|2|0|3|5|4|3|1=bonesharpen|
7229|Skelton Axe|2|0|3|5|6|3|1=bonesharpen|
5230|Shard of Sacrifice|2|3|3|2|||sosa|
7230|Shard of Sacrifice|2|3|3|2|||sosa|
5250|Death Pendulum|2|2|0|0|||pend|pillar+stackable+additive+charges=1
Expand Down Expand Up @@ -242,8 +242,8 @@
7326|Brawl|3|3|3|13|||brawl|
5327|Boar|3|4|1|3|2|1|growth 1 0|
7327|Boar|3|4|1|3|3|1|growth 1 1|
5328|Scepter of Ruling|3|0|3|5|7|5|3:12=rule|
7328|Scepter of Ruling|3|0|3|5|8|5|2:12=rule|
5328|Scepter of Ruling|3|0|3|5|7|5|2:12=beguile|
7328|Scepter of Ruling|3|0|3|5|8|5|1:12=beguile|
5330|Shard of Focus|3|4|3|6||1|1=accretion|
7330|Shard of Focus|3|4|3|4||1|1=accretion|
5331|Stasis|3|3|2|1|||stasisdraw+owndraw=sanctify+owndiscard=sanctify|
Expand Down Expand Up @@ -817,4 +817,4 @@
6230|Shard of Wisdom|12|3|3|3|||wisdom|
8230|Shard of Wisdom|12|3|3|2|||wisdom|
6250|Aether Pendulum|12|2|0|0|||pend|pillar+stackable+additive+charges=1
8250|Aether Pendulum|12|2|0|0|||pend+ownplay=pillar1|pillar+stackable+additive+charges=1
8250|Aether Pendulum|12|2|0|0|||pend+ownplay=pillar1|pillar+stackable+additive+charges=1
143 changes: 143 additions & 0 deletions src/rs/src/skill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ pub enum Skill {
blockhp,
bloodmoon,
bolsterintodeck,
bonesharpen,
boneyard,
bounce,
bow,
Expand All @@ -276,6 +277,7 @@ pub enum Skill {
brokenmirror,
bubbleclear,
burrow,
burstout,
butterfly,
catapult,
catlife,
Expand All @@ -293,6 +295,8 @@ pub enum Skill {
cseed,
cseed2,
dagger,
databloat,
datashrink,
deadalive,
deathwish,
deckblast,
Expand Down Expand Up @@ -353,13 +357,15 @@ pub enum Skill {
firebrand,
firestorm(i16),
firewall,
fish,
flood,
flooddeath,
flyingweapon,
flyself,
foedraw,
forcedraw,
forceplay,
fossilize,
fractal,
frail,
frail2,
Expand All @@ -375,6 +381,7 @@ pub enum Skill {
golemhit,
gpull,
gpullspell,
grab2h,
grave,
growth(i8, i8),
guard,
Expand All @@ -383,8 +390,10 @@ pub enum Skill {
hammer,
hasten,
hatch,
haunt,
heal,
heatmirror,
heatstroke,
hitownertwice,
holylight,
hope,
Expand Down Expand Up @@ -466,6 +475,7 @@ pub enum Skill {
precognition,
predator,
predatoroff,
protect,
protectall,
protectonce,
protectoncedmg,
Expand Down Expand Up @@ -502,6 +512,7 @@ pub enum Skill {
scramblespam,
serendipity,
shardgolem,
shazam,
shtriga,
shuffle3,
silence,
Expand Down Expand Up @@ -536,6 +547,7 @@ pub enum Skill {
tempering(i16),
tesseractsummon,
thorn(u8),
throwfeather,
throwrock,
tick,
tidalhealing,
Expand Down Expand Up @@ -900,6 +912,19 @@ impl<'a> Display for SkillName<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let &SkillName { sk, ctx, id } = self;
match sk {
Skill::bonesharpen => f.write_str("bonesharpen"),
Skill::burstout => f.write_str("burstout"),
Skill::databloat => f.write_str("databloat"),
Skill::datashrink => f.write_str("datashrink"),
Skill::haunt => f.write_str("haunt"),
Skill::throwfeather => f.write_str("throwfeather"),
Skill::heatstroke => f.write_str("heatstroke"),
Skill::grab2h
=> f.write_str("grab2h"),
Skill::protect => f.write_str("protect"),
Skill::fish => f.write_str("fish"),
Skill::shazam => f.write_str("shazam"),
Skill::fossilize => f.write_str("fossilize"),
Skill::r#_tracedeath => Ok(()),
Skill::abomination => Ok(()),
Skill::absorbdmg => f.write_str("absorbdmg"),
Expand Down Expand Up @@ -1571,6 +1596,124 @@ impl Skill {

pub fn proc(self, ctx: &mut Game, c: i16, t: i16, data: &mut ProcData) {
match self {
Skill::bonesharpen => {
ctx.incrAtk(t, ctx.get(c, Stat::atk));
}
Skill::burstout => {
let owner = ctx.get_owner(c);
let mut n = 0;
for cr in ctx.get_player(owner).creatures {
if cr != 0 {
let crcard = ctx.get(cr, Stat::card);
let bugs = [card::ChromaticButterfly,
card::SpiderCow,
card::Deathstalker,
card::FleshSpider,
card::Antlion,
card::Graboid,
card::Shrieker,
card::Scorpion,
card::GiantSpider,
card::AshEater,
card::DivingBellSpider,
card::BobbitWorm,
card::NullMantis,
card::Dragonfly,
card::Firefly,
card::FireflyQueen,
card::Scarab,
card::DuneScorpion,
card::Devourer,
card::Parasite,
card::PhaseSpider,
];
if bugs.iter().any(|x| card::IsOf(crcard, x)) {
n += 1;
Skill::parallel.proc(ctx, cr, cr, data);
}
}
}
ctx.poison(owner, n);
}
Skill::databloat => {
if ctx.get_kind(t) == Kind::Player {
for id in ctx.get_player(t).hand_iter() {
ctx.incrStatus(t, Stat::cost, 1)
}
} else {
ctx.incrStatus(t, Stat::cost, 2)
}

}
Skill::datashrink => {
if ctx.get_kind(t) == Kind::Player {
for id in ctx.get_player(t).hand_iter() {
ctx.incrStatus(t, Stat::cost, -1)
}
} else {
ctx.incrStatus(t, Stat::cost, -2)
}
}
Skill::haunt => {}
Skill::throwfeather => {}
Skill::heatstroke => {}
Skill::grab2h => {}
Skill::protect => {}
Skill::fish => {}
Skill::shazam => {
let owner = ctx.get_owner(c);
let mut options = [etg::Chroma; 3];
let mut idx = 0;
if ctx.get_player(owner).quanta(etg::Life) > 1 {
options[idx as usize] = etg::Life;
idx += 1;
}
if ctx.get_player(owner).quanta(etg::Light) > 1 {
options[idx as usize] = etg::Light;
idx += 1;
}
if ctx.get_player(owner).quanta(etg::Air) > 1 {
options[idx as usize] = etg::Air;
idx += 1;
}
if idx != 0 {
let option = options[ctx.upto(idx)];
ctx.spend(owner, option, 2);
match option {
etg::Life => {
let town = ctx.get_owner(t);
ctx.set(town, Stat::gpull, t);
ctx.transform(t, card::GuardianAngel);
}
etg::Light => {
ctx.set(t, Stat::atk, 3);
ctx.set(t, Stat::hp, 3);
}
etg::Air => {
ctx.transform(t, card::Wyrm);
ctx.set(t, Stat::atk, 2);
ctx.set(t, Stat::hp, 2);
}
_ => unsafe { core::hint::unreachable_unchecked() },

}
}
}
Skill::fossilize => {
if ctx.get(t, Flag::golem) {
let town = ctx.get_owner(t);
ctx.set(town, Stat::gpull, t);
ctx.dmg(t, -20);
} else {
let atk = ctx.get(t, Stat::atk);
let hp = ctx.get(t, Stat::hp);
let maxhp = ctx.get(t, Stat::maxhp);
ctx.transform(t, card::ClockworkGolem);
ctx.set(t, Stat::atk, atk);
ctx.set(t, Stat::hp, hp);
ctx.set(t, Stat::maxhp, maxhp);
}
}
Self::r#_tracedeath => {
ctx.incrStatus(ctx.turn, Stat::lives, 1);
}
Expand Down

0 comments on commit bdad87a

Please sign in to comment.