import { EggbugEmotion, EggbugImg, HCenter, Main, render_and_copy, } from "./common.tsx"; const Eggbug = ({ type = "smiling" }: { type?: EggbugEmotion }) => ( ); function health_style(current: number, last: number, max: number) { const inc_width = 100 / max; const dhealth = last - current; console.log(inc_width, dhealth); return { transform: `translateX(${-(inc_width * dhealth)}%)`, width: `${last * inc_width}%`, }; } // could be generalized // might be worthwhile later since is BAN const Health = ({ current, last, max, }: { current: number; last: number; max: number; }) => ( console.log({ current, last, max }), (
{Math.floor(current).toString()} /{max.toString()}
) ); // one-time animations of hit numbers of health flying off the screen const BattleFrame = ({ health, last_health, max_health, phase, }: { health: number; last_health: number; max_health: number; phase: 1 | 2; }) => (
); const Defeated = ({ last_health, max_health, phase, }: { last_health: number; max_health: number; phase: 1 | 2; }) => phase == 1 ? (
eggbug is physically unharmed, emotionally destroyed
...
ok eggbug is fine now
"re bug" to "killbug"
submit runs to{" "} #KILLing eggbug rapidly {" "}
click again
at you OWN PREIL!
) : (

WHAT HAVE YOU DONE
); const DamageNumber = ({ dmg, max_dmg, shl, }: { dmg: number; max_dmg: number; shl: number; }) => (
{Math.round(dmg).toString()}
); const Battle = ({ max_health = 100, health = max_health, last_health = health, damage_multiplier = 10, damage_bonus = 1, phase = 1, }: // ...rest Partial<{ max_health: number; health: number; last_health: number; damage_multiplier: number; damage_bonus: number; phase?: 1 | 2; }>) => health > 0 ? (
{health < last_health && ( )}
) : ( ); // a timer would be flippin rad // (it would look like an actual scrolling clock thingie) // (because it would have to) render_and_copy(
{/* */}
);