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

168 lines
4.8 KiB
JavaScript

var __extends =
(this && this.__extends) ||
(function () {
var extendStatics = function (d, b) {
extendStatics =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b)
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
};
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError(
"Class extends value " + String(b) + " is not a constructor or null"
);
extendStatics(d, b);
function __() {
this.constructor = d;
}
d.prototype =
b === null
? Object.create(b)
: ((__.prototype = b.prototype), new __());
};
})();
var Sprite_DouseiMan = /** @class */ (function (_super) {
__extends(Sprite_DouseiMan, _super);
function Sprite_DouseiMan(event) {
var _this = _super.call(this, event) || this;
_this.calcDouseiActor(event);
_this.checkDouseiSex(event);
return _this;
}
Sprite_DouseiMan.prototype.calcDouseiActor = function (event) {
this._douseiActorId = parseInt(event.event().meta["dousei"]);
};
Sprite_DouseiMan.prototype.checkDouseiSex = function (event) {
this._douseiSex = event.event().meta["douseiSex"] != null;
};
Sprite_DouseiMan.prototype.updateBitmap = function () {
if (this.isImageChanged()) {
this._tilesetId = $gameMap.tilesetId();
this._tileId = this._character.tileId();
this._characterName = this.characterName();
this._characterIndex = this.characterIndex();
if (this._tileId > 0) {
this.setTileBitmap();
} else {
this.setCharacterBitmap();
}
}
};
Sprite_DouseiMan.prototype.characterName = function () {
if (this._character.characterName() == "") {
return "";
}
var actor = $gameActors.actor(this._douseiActorId);
var manId = actor.dousei().manId();
if (manId == 0) {
return "";
}
var man = $gameActors.actor(manId);
if (!man) {
console.error(manId + "の男が見つかりません");
return "";
}
return man.actor().characterName;
};
Sprite_DouseiMan.prototype.characterIndex = function () {
var actor = $gameActors.actor(this._douseiActorId);
var manId = actor.dousei().manId();
if (manId == 0) {
return 0;
}
var man = $gameActors.actor(manId);
if (!man) {
console.error(manId + "の男が見つかりません");
return 0;
}
return man.actor().characterIndex;
};
/*characterPatternX() {
if (this.isDouseiSex()) {
return 1;
} else {
return super.characterPatternX();
}
}*/
Sprite_DouseiMan.prototype.updatePosition = function () {
this.x = this._character.screenX();
this.y = this._character.screenY();
this.z = this._character.screenZ();
if (this.isDouseiSex()) {
this.y -= this._character.pattern() * 2;
}
};
Sprite_DouseiMan.prototype.isDouseiSex = function () {
var varValue = $gameVariables.value(this.douseiVarId());
switch (varValue) {
case Nore.DOUSEI_CHAR_VAR.sex:
case Nore.DOUSEI_CHAR_VAR.kijoui:
case Nore.DOUSEI_CHAR_VAR.gyaku:
case Nore.DOUSEI_CHAR_VAR.kunni:
break;
case Nore.DOUSEI_CHAR_VAR.cri:
case Nore.DOUSEI_CHAR_VAR.fela:
case Nore.DOUSEI_CHAR_VAR.sm:
case Nore.DOUSEI_CHAR_VAR.back:
return false;
}
return this._douseiSex;
};
Sprite_DouseiMan.prototype.douseiVarId = function () {
var actorId = this._douseiActorId;
switch (actorId) {
case 10:
return Nore.KANAMI_DOUSEI_VAR;
case 11:
return Nore.MIYU_DOUSEI_VAR;
case 8:
return Nore.SENRI_DOUSEI_VAR;
case 9:
return Nore.NONOKA_DOUSEI_VAR;
case 4:
return Nore.MARINA_DOUSEI_VAR;
case 13:
return Nore.SAKI_DOUSEI_VAR;
case 17:
return Nore.KOKONA_DOUSEI_VAR;
}
return -1;
};
Sprite_DouseiMan.prototype.isImageChanged = function () {
return (
this._characterName !== this.characterName() ||
this._characterIndex !== this.characterIndex()
);
};
Sprite_DouseiMan.prototype.characterBlockX = function () {
var index = this.characterIndex();
return (index % 4) * 3;
};
Sprite_DouseiMan.prototype.characterBlockY = function () {
var index = this.characterIndex();
if (this._character.characterIndex() >= 4) {
if (index < 4) {
index += 4;
}
}
return Math.floor(index / 4) * 4;
};
return Sprite_DouseiMan;
})(Sprite_Character);
function isDouseiManEvent(event) {
if (!event) {
return false;
}
if (!event.event()) {
return false;
}
return event.event().meta["dousei"] != null;
}