Rewrite thrall rewards

This commit is contained in:
Pyrex 2025-02-22 21:08:03 -08:00
parent 09e619208a
commit bd1cff68e6
3 changed files with 54 additions and 29 deletions

View File

@ -59,7 +59,8 @@ export class Floater {
let dist = playerPos.distance(this.xy); let dist = playerPos.distance(this.xy);
let dir = Math.atan2(this.xy.y - playerPos.y, this.xy.x - playerPos.x); let dir = Math.atan2(this.xy.y - playerPos.y, this.xy.x - playerPos.x);
if (dist < 0.3) { if (this.frame >= 60) {
if (dist < 0.5) {
this.collect(); this.collect();
} }
let gravityAmt = (0.6 - dist) / 0.6; let gravityAmt = (0.6 - dist) / 0.6;
@ -72,6 +73,7 @@ export class Floater {
); );
} }
} }
}
collect() { collect() {
if (this.collected) { if (this.collected) {
return; return;

View File

@ -600,7 +600,7 @@ export class ThrallCollectionPlatePickup {
update() {} update() {}
onClick(_cell: CellView): boolean { onClick(cell: CellView): boolean {
let lifeStage = getPlayerProgress().getThrallLifeStage(this.thrall); let lifeStage = getPlayerProgress().getThrallLifeStage(this.thrall);
let itemStage = getPlayerProgress().getThrallItemStage(this.thrall); let itemStage = getPlayerProgress().getThrallItemStage(this.thrall);
let data = getThralls().get(this.thrall); let data = getThralls().get(this.thrall);
@ -650,7 +650,7 @@ export class ThrallCollectionPlatePickup {
}, },
null, null,
); );
data.rewardCallback(); data.rewardCallback((what) => this.spawn(cell.xy, what));
} }
} }
@ -658,6 +658,29 @@ export class ThrallCollectionPlatePickup {
return true; return true;
} }
spawn(xy: Point, what: Stat | "EXP") {
let callbacks = null;
if (what == "EXP") {
callbacks = new ExperiencePickupCallbacks();
} else {
callbacks = new StatPickupCallbacks(what);
}
if (callbacks == null) { return; }
let floater = new Floater(
xy.offset(new Point(0.5, 0.5)),
50,
callbacks,
);
let speed = 0.015;
let direction = Math.random() * Math.PI * 2;
floater.velocity = new Point(
Math.cos(direction) * speed,
Math.sin(direction) * speed * 0.1,
);
floater.velZ = 0.8;
getHuntMode().spawnFloater(floater);
}
onSqueeze() {} onSqueeze() {}
} }

View File

@ -22,7 +22,7 @@ import {
sprThrallStealth, sprThrallStealth,
} from "./sprites.ts"; } from "./sprites.ts";
import { Sprite } from "./engine/internal/sprite.ts"; import { Sprite } from "./engine/internal/sprite.ts";
import { getPlayerProgress } from "./playerprogress.ts"; import {Stat} from "./datatypes.ts";
export type Thrall = { export type Thrall = {
id: number; id: number;
@ -62,7 +62,7 @@ export type ThrallData = {
itemPickupMessage: string; itemPickupMessage: string;
deliveryMessage: string; deliveryMessage: string;
rewardMessage: string; rewardMessage: string;
rewardCallback: () => void; rewardCallback: (spawn: (what: Stat | "EXP") => void) => void;
lifeStageText: Record<LifeStage, LifeStageText>; lifeStageText: Record<LifeStage, LifeStageText>;
}; };
@ -132,8 +132,8 @@ export let thrallParty = table.add({
deliveryMessage: deliveryMessage:
'"Oh, that? Yeah, I won it." And then lost it, apparently.\n\nHe\'s elated. He will never leave.', '"Oh, that? Yeah, I won it." And then lost it, apparently.\n\nHe\'s elated. He will never leave.',
rewardMessage: "Garrett showers you with INT!", rewardMessage: "Garrett showers you with INT!",
rewardCallback: () => { rewardCallback: (spawn) => {
getPlayerProgress().add("INT", 10); for (let i = 0; i < 30; i++) { spawn("INT"); }
}, },
lifeStageText: { lifeStageText: {
fresh: { fresh: {
@ -204,8 +204,8 @@ export let thrallLore = table.add({
deliveryMessage: deliveryMessage:
"Lupin looks at his own reflection -- with interest, confusion, dismissal, and then deep satisfaction. He loves it. He will never leave.", "Lupin looks at his own reflection -- with interest, confusion, dismissal, and then deep satisfaction. He loves it. He will never leave.",
rewardMessage: "Lupin showers you with AGI!", rewardMessage: "Lupin showers you with AGI!",
rewardCallback: () => { rewardCallback: (spawn) => {
getPlayerProgress().add("AGI", 10); for (let i = 0; i < 30; i++) { spawn("AGI"); }
}, },
lifeStageText: { lifeStageText: {
fresh: { fresh: {
@ -273,9 +273,9 @@ export let thrallBat = table.add({
deliveryMessage: deliveryMessage:
'Monica salivates. "This is... this is... simply exquisite!"\n\nShe is happy. She will never leave.', 'Monica salivates. "This is... this is... simply exquisite!"\n\nShe is happy. She will never leave.',
rewardMessage: "Monica showers you with CHA and INT!", rewardMessage: "Monica showers you with CHA and INT!",
rewardCallback: () => { rewardCallback: (spawn) => {
getPlayerProgress().add("CHA", 5); for (let i = 0; i < 15; i++) { spawn("CHA"); }
getPlayerProgress().add("INT", 5); for (let i = 0; i < 15; i++) { spawn("INT"); }
}, },
lifeStageText: { lifeStageText: {
fresh: { fresh: {
@ -343,8 +343,8 @@ export let thrallCharm = table.add({
deliveryMessage: deliveryMessage:
"Renfield inhales sharply and widens his stance, trying to hide his physical reaction to your face. He is elated and will never leave.", "Renfield inhales sharply and widens his stance, trying to hide his physical reaction to your face. He is elated and will never leave.",
rewardMessage: "Renfield showers you with PSI!", rewardMessage: "Renfield showers you with PSI!",
rewardCallback: () => { rewardCallback: (spawn) => {
getPlayerProgress().add("PSI", 10); for (let i = 0; i < 24; i++) { spawn("PSI"); }
}, },
lifeStageText: { lifeStageText: {
fresh: { fresh: {
@ -410,9 +410,9 @@ export let thrallStealth = table.add({
deliveryMessage: deliveryMessage:
"\"That? That's not mine.\" But she wants it. Now it's hers. She will never leave.", "\"That? That's not mine.\" But she wants it. Now it's hers. She will never leave.",
rewardMessage: "Narthyss showers you with CHA and AGI!", rewardMessage: "Narthyss showers you with CHA and AGI!",
rewardCallback: () => { rewardCallback: (spawn) => {
getPlayerProgress().add("CHA", 5); for (let i = 0; i < 15; i++) { spawn("CHA"); }
getPlayerProgress().add("AGI", 5); for (let i = 0; i < 15; i++) { spawn("AGI"); }
}, },
lifeStageText: { lifeStageText: {
fresh: { fresh: {
@ -479,8 +479,8 @@ export let thrallStare = table.add({
deliveryMessage: deliveryMessage:
"Ridley admires the gear but -- to your surprise -- refuses to jam it into its brain.\n\nThe pup is elated and will never leave.", "Ridley admires the gear but -- to your surprise -- refuses to jam it into its brain.\n\nThe pup is elated and will never leave.",
rewardMessage: "Ridley showers you with EXP!", rewardMessage: "Ridley showers you with EXP!",
rewardCallback: () => { rewardCallback: (spawn) => {
getPlayerProgress().addExperience(100); for (let i = 0; i < 6; i++) { spawn("EXP"); }
}, },
lifeStageText: { lifeStageText: {
fresh: { fresh: {