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

78 lines
2.3 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_DouseiIdle = /** @class */ (function (_super) {
__extends(Sprite_DouseiIdle, _super);
function Sprite_DouseiIdle(actorId) {
var _this = _super.call(this) || this;
_this._actorId = actorId;
var actor = $gameActors.actor(_this._actorId);
_this._dousei = actor.dousei();
_this.bitmap = new Bitmap(130, 100);
_this.refresh();
return _this;
}
Sprite_DouseiIdle.prototype.refresh = function () {
this.bitmap.clear();
if (this._dousei.manId() > 0) {
this._lastMan = this._dousei.manId();
var man = $gameActors.actor(this._dousei.manId());
this.drawIcon(man.iconIndex(), 14, 20);
var actor = $gameActors.actor(this._actorId);
this._lastFriendship = actor.friendship(this._lastMan);
this.bitmap.drawText(this._lastFriendship + "", 10, 20, 80, 32, "right");
} else {
this._lastMan = 0;
this._lastFriendship = 0;
}
};
Sprite_DouseiIdle.prototype.update = function () {
_super.prototype.update.call(this);
if (this.isChanged()) {
this.refresh();
}
};
Sprite_DouseiIdle.prototype.isChanged = function () {
if (this._lastMan != this._dousei.manId()) {
return true;
}
if (this._lastMan == 0) {
return false;
}
var actor = $gameActors.actor(this._actorId);
var friendShip = actor.friendship(this._lastMan);
if (this._lastFriendship != friendShip) {
return true;
}
return false;
};
return Sprite_DouseiIdle;
})(Sprite);