dead-bunny/js/plugins/Nore_Tanetsuke.js
2025-01-12 01:21:39 -06:00

206 lines
6.2 KiB
JavaScript

var TanetsukeStatus;
(function (TanetsukeStatus) {
TanetsukeStatus[(TanetsukeStatus["none"] = 0)] = "none";
TanetsukeStatus[(TanetsukeStatus["play"] = 1)] = "play";
TanetsukeStatus[(TanetsukeStatus["firstSex"] = 2)] = "firstSex";
TanetsukeStatus[(TanetsukeStatus["inSex"] = 3)] = "inSex";
TanetsukeStatus[(TanetsukeStatus["fertilize"] = 4)] = "fertilize";
TanetsukeStatus[(TanetsukeStatus["failure"] = 5)] = "failure";
TanetsukeStatus[(TanetsukeStatus["pregnant"] = 6)] = "pregnant";
TanetsukeStatus[(TanetsukeStatus["syusan"] = 7)] = "syusan";
TanetsukeStatus[(TanetsukeStatus["finished"] = 8)] = "finished";
})(TanetsukeStatus || (TanetsukeStatus = {}));
var BONUS = 5;
var TanetsukeInfo = /** @class */ (function () {
function TanetsukeInfo(actorId) {
this._history = [];
this._actorId = actorId;
this.createBlankHistory();
}
TanetsukeInfo.prototype.createBlankHistory = function () {
this._history.push(new TanetsukeHistory(this.actorId(), -1, -100));
};
TanetsukeInfo.prototype.tanetsuke = function (manId) {
var bonus = 0;
var history = this.lastHistory();
if (history) {
if (history.status() == TanetsukeStatus.failure) {
if (history.manId() == manId) {
bonus = history.bonus() + BONUS;
}
}
}
this._history.push(new TanetsukeHistory(this.actorId(), manId, bonus));
};
TanetsukeInfo.prototype.actorId = function () {
return this._actorId;
};
TanetsukeInfo.prototype.status = function () {
return this.lastHistory().status();
};
TanetsukeInfo.prototype.lastHistory = function () {
if (this._history.length == 0) {
return null;
}
return this._history[this._history.length - 1];
};
TanetsukeInfo.prototype.manName = function () {
return this.lastHistory().manName();
};
TanetsukeInfo.prototype.update = function () {
this.lastHistory().update();
};
TanetsukeInfo.prototype.rate = function () {
return this.lastHistory().rate();
};
TanetsukeInfo.prototype.isDirty = function () {
return this.lastHistory().isDirty();
};
TanetsukeInfo.prototype.clearDirty = function () {
return this.lastHistory().clearDirty();
};
TanetsukeInfo.prototype.ninshinRate = function () {
return this.lastHistory().ninshinRate();
};
return TanetsukeInfo;
})();
var TanetsukeHistory = /** @class */ (function () {
function TanetsukeHistory(actorId, manId, bonus) {
this._time = 0;
this._sexCount = 0;
this._actorId = actorId;
this._manId = manId;
this._bonus = bonus;
if (manId < 0) {
this._status = TanetsukeStatus.none;
} else {
this._status = TanetsukeStatus.play;
}
this._maxTime = this.calcMaxTime();
}
TanetsukeHistory.prototype.status = function () {
return this._status;
};
TanetsukeHistory.prototype.manName = function () {
var man = $gameActors.actor(this._manId);
return man.name();
};
TanetsukeHistory.prototype.calcMaxTime = function () {
return $slg.calcTanetsukeTime(5);
};
TanetsukeHistory.prototype.calsPregrantTime = function () {
return $slg.calcPregantTime(5);
};
TanetsukeHistory.prototype.update = function () {
if (this.isTimeEvent()) {
this._time++;
if (this.isTanetsukeEvent()) {
this.updateTanetsuke();
} else if (this.isSyusanEvent()) {
this.updateSyusan();
}
}
};
TanetsukeHistory.prototype.updateTanetsuke = function () {
if (this._time >= this._maxTime) {
this.checkNinshin();
}
};
TanetsukeHistory.prototype.updateSyusan = function () {
if (this._time >= this._maxTime) {
this._status = TanetsukeStatus.syusan;
}
};
TanetsukeHistory.prototype.isTimeEvent = function () {
switch (this.status()) {
case TanetsukeStatus.play:
case TanetsukeStatus.failure:
case TanetsukeStatus.inSex:
case TanetsukeStatus.pregnant:
return true;
}
return false;
};
TanetsukeHistory.prototype.isTanetsukeEvent = function () {
switch (this.status()) {
case TanetsukeStatus.play:
case TanetsukeStatus.failure:
case TanetsukeStatus.inSex:
return true;
}
};
TanetsukeHistory.prototype.isSyusanEvent = function () {
switch (this.status()) {
case TanetsukeStatus.pregnant:
return true;
}
return false;
};
TanetsukeHistory.prototype.rate = function () {
var max = 1;
return Math.min(this._time / this._maxTime, max);
};
TanetsukeHistory.prototype.actorId = function () {
return this._actorId;
};
TanetsukeHistory.prototype.actor = function () {
return $gameActors.actor(this._actorId);
};
TanetsukeHistory.prototype.checkNinshin = function () {
//const dice = Math.random();
//let ninshin = dice < this.ninshinRate();
var actor = this.actor();
var damage = Math.round(10 * Math.random()) + 4;
actor.gainHp(-damage);
if (actor.hp <= 0) {
this._status = TanetsukeStatus.fertilize;
} else {
if (this.isFirstSex()) {
this._status = TanetsukeStatus.firstSex;
} else {
this._status = TanetsukeStatus.failure;
}
this._sexCount++;
this._time = 0;
this._bonus += 5;
}
this._dirty = true;
};
TanetsukeHistory.prototype.ninshinRate = function () {
return 0.55 + this.bonus() / 100;
};
TanetsukeHistory.prototype.manId = function () {
return this._manId;
};
TanetsukeHistory.prototype.bonus = function () {
return this._bonus;
};
TanetsukeHistory.prototype.isDirty = function () {
return this._dirty;
};
TanetsukeHistory.prototype.clearDirty = function () {
this._dirty = false;
};
TanetsukeHistory.prototype.becomePregnant = function () {
this._status = TanetsukeStatus.pregnant;
this._time = 0;
this._maxTime = this.calsPregrantTime();
};
TanetsukeHistory.prototype.syusan = function () {
this._status = TanetsukeStatus.finished;
this._time = 0;
this._price = this.calcPrice();
var actor = this.actor();
actor.recoverAll();
};
TanetsukeHistory.prototype.calcPrice = function () {
return 300;
};
TanetsukeHistory.prototype.isFirstSex = function () {
return this._sexCount == 0;
};
TanetsukeHistory.prototype.playSex = function () {
this._status = TanetsukeStatus.inSex;
};
return TanetsukeHistory;
})();