ss
This commit is contained in:
parent
091afc2b5c
commit
28591233f3
85 changed files with 946 additions and 267 deletions
|
|
@ -4,12 +4,34 @@
|
|||
const Tarinai = global.Tarinai;
|
||||
if (!Tarinai) throw new Error("Tarinai is not available for mixin: tarinai_action_state.js");
|
||||
|
||||
function prepareTarinaiIntimidatePresentation(tarinai) {
|
||||
if (!tarinai || tarinai.dead) return "intimidate";
|
||||
if (!tarinai.intimidateSpriteVariant) {
|
||||
tarinai.intimidateSpriteVariant = tarinai.isAcquiredTarinai ? "intimidate_alt" : (Math.random() < 0.5 ? "intimidate_alt" : "intimidate");
|
||||
}
|
||||
if (tarinai.intimidateSpriteVariant === "intimidate_alt" && !tarinai._intimidateAltAnnounced) {
|
||||
tarinai._intimidateAltAnnounced = true;
|
||||
tarinai.bubble?.("ぷきゅー!", 1.0, "rgba(92,62,34,0.82)", { force: true });
|
||||
const audio = global.TarinaiAudio;
|
||||
if (audio?.playSample) audio.playSample("voice_intimidate_alt", 0.9, "voice") || audio.play?.("voice_intimidate_alt", { category: "voice", minGap: 0.9 });
|
||||
else audio?.play?.("voice_intimidate_alt", { category: "voice", minGap: 0.9 });
|
||||
}
|
||||
return tarinai.intimidateSpriteVariant;
|
||||
}
|
||||
global.prepareTarinaiIntimidatePresentation = prepareTarinaiIntimidatePresentation;
|
||||
|
||||
Object.defineProperties(Tarinai.prototype, Object.getOwnPropertyDescriptors({
|
||||
setActionState(state, opts = {}) {
|
||||
if (this.dead) return false;
|
||||
const wasSleeping = this.state === "sleep" || this.sleeping;
|
||||
const previousState = this.state;
|
||||
const nextState = state || "idle";
|
||||
this.state = nextState;
|
||||
if (nextState === "intimidate" || nextState === "ant_intimidate") prepareTarinaiIntimidatePresentation(this);
|
||||
else if ((previousState === "intimidate" || previousState === "ant_intimidate") && nextState !== previousState) {
|
||||
this.intimidateSpriteVariant = "";
|
||||
this._intimidateAltAnnounced = false;
|
||||
}
|
||||
if ("target" in opts) this.target = opts.target;
|
||||
if (opts.reason != null) this.thought = String(opts.reason || "");
|
||||
if (opts.clearTarget) this.target = null;
|
||||
|
|
@ -204,7 +226,17 @@
|
|||
this.fallTimer = Math.max(this.fallTimer || 0, opts.fallTimer);
|
||||
this.fallMax = Math.max(this.fallMax || 0, this.fallTimer);
|
||||
}
|
||||
if (opts.bubble) this.bubble?.(opts.bubble, opts.bubbleCooldown ?? 0.9, opts.bubbleColor || "rgba(84,66,86,0.80)");
|
||||
if (opts.bubble && !this.isAcquiredTarinai) this.bubble?.(opts.bubble, opts.bubbleCooldown ?? 0.9, opts.bubbleColor || "rgba(84,66,86,0.80)");
|
||||
if (this.isAcquiredTarinai) {
|
||||
const now = Number(this.world?.time || 0) || 0;
|
||||
if (now >= Number(this.ochibiPanicVoiceAt || 0)) {
|
||||
this.ochibiPanicVoiceAt = now + 2.4;
|
||||
if (this.bubble?.("きょわいのだ...", 1.8, "rgba(84,66,86,0.80)", { force: true })) {
|
||||
const a = global.TarinaiAudio;
|
||||
if (a?.playSample) a.playSample("voice_ochibi_panic_005", 1.0, "voice") || a.play?.("voice_ochibi_panic_005", { category: "voice", minGap: 1.0 });
|
||||
}
|
||||
}
|
||||
}
|
||||
this.lastPanicCause = opts.cause || opts.reason || this.thought || "panic";
|
||||
this.lastPanicAt = this.world?.time || 0;
|
||||
if (this.state === "panic" && !Number.isFinite(this.panicStartedAt)) this.panicStartedAt = this.lastPanicAt;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue