172 lines
4.4 KiB
JavaScript
172 lines
4.4 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 __());
|
|
};
|
|
})();
|
|
/*:ja
|
|
* @target MZ
|
|
* @author ル
|
|
*
|
|
* @command makeBabyRoom
|
|
* @text 赤ん坊画面作成
|
|
* @des 赤ん坊画面作成
|
|
* @arg actorId
|
|
* @type number
|
|
*
|
|
*
|
|
*/
|
|
var Nore;
|
|
(function (Nore) {
|
|
var pluginName = "Nore_Baby";
|
|
PluginManager.registerCommand(pluginName, "makeBabyRoom", function (args) {
|
|
var actorId = Math.trunc(args.actorId);
|
|
var actor = $gameActors.actor(actorId);
|
|
for (var i = 0; i < 15; i++) {
|
|
var varId = getBabyVar(i);
|
|
$gameVariables.setValue(varId, 0);
|
|
}
|
|
var index = 0;
|
|
var babyList = [];
|
|
for (var _i = 0, _a = actor.babyList(); _i < _a.length; _i++) {
|
|
var b = _a[_i];
|
|
if (!b.isSyusan()) {
|
|
continue;
|
|
}
|
|
babyList.unshift(b);
|
|
}
|
|
for (var _b = 0, babyList_1 = babyList; _b < babyList_1.length; _b++) {
|
|
var baby = babyList_1[_b];
|
|
var id = imageId(baby);
|
|
var varId = getBabyVar(index);
|
|
$gameVariables.setValue(varId, id);
|
|
index++;
|
|
if (index >= 15) {
|
|
break;
|
|
}
|
|
}
|
|
$gameVariables.setValue(960, index);
|
|
});
|
|
function getBabyVar(index) {
|
|
return 959 - index;
|
|
}
|
|
function imageId(baby) {
|
|
if (baby.isBlack()) {
|
|
if (baby.imageIndex() == 1) {
|
|
return 13 + baby.growth();
|
|
} else {
|
|
return 16 + baby.growth();
|
|
}
|
|
}
|
|
if (baby.isMale()) {
|
|
if (baby.imageIndex() == 1) {
|
|
return 7 + baby.growth();
|
|
} else {
|
|
return 10 + baby.growth();
|
|
}
|
|
}
|
|
if (baby.imageIndex() == 1) {
|
|
return 1 + baby.growth();
|
|
} else {
|
|
return 4 + baby.growth();
|
|
}
|
|
}
|
|
})(Nore || (Nore = {}));
|
|
var Sprite_BabyCharacter = /** @class */ (function (_super) {
|
|
__extends(Sprite_BabyCharacter, _super);
|
|
function Sprite_BabyCharacter(event) {
|
|
var _this = _super.call(this, event) || this;
|
|
_this.calcBabyActor(event);
|
|
_this._baby = _this.lastBaby();
|
|
$gameSwitches.setValue(_this.backSw(), _this._baby != null);
|
|
return _this;
|
|
}
|
|
Sprite_BabyCharacter.prototype.backSw = function () {
|
|
switch (this._babyActorId) {
|
|
case 9:
|
|
return 163;
|
|
case 4:
|
|
return 169;
|
|
case 13:
|
|
return 166;
|
|
case 17:
|
|
return 172;
|
|
}
|
|
return -1;
|
|
};
|
|
Sprite_BabyCharacter.prototype.calcBabyActor = function (event) {
|
|
this._babyActorId = parseInt(event.event().meta["baby"]);
|
|
};
|
|
Sprite_BabyCharacter.prototype.updateBitmap = function () {
|
|
if (this.isImageChanged()) {
|
|
this._tilesetId = $gameMap.tilesetId();
|
|
this._tileId = this._character.tileId();
|
|
if (this._baby) {
|
|
this._characterName = this._baby.babyImageId();
|
|
this._characterIndex = 0;
|
|
} else {
|
|
this._characterName = "";
|
|
this._characterIndex = 0;
|
|
}
|
|
this.setCharacterBitmap();
|
|
}
|
|
};
|
|
Sprite_BabyCharacter.prototype.characterPatternY = function () {
|
|
if (!this._baby) {
|
|
return 0;
|
|
}
|
|
return this._baby.growth();
|
|
};
|
|
Sprite_BabyCharacter.prototype.lastBaby = function () {
|
|
var actor = $gameActors.actor(this._babyActorId);
|
|
var manId = actor.dousei().manId();
|
|
if (manId == 0) {
|
|
return null;
|
|
}
|
|
var babyList = actor.babyList();
|
|
for (var i = 0; i < babyList.length; i++) {
|
|
var baby = babyList[babyList.length - 1 - i];
|
|
if (baby.isSyusan()) {
|
|
if (baby.taneoyaId() == manId) {
|
|
return baby;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
return Sprite_BabyCharacter;
|
|
})(Sprite_Character);
|
|
function isBabyCharacterEvent(event) {
|
|
if (!event) {
|
|
return false;
|
|
}
|
|
if (!event.event()) {
|
|
return false;
|
|
}
|
|
return event.event().meta["baby"] != null;
|
|
}
|