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

1529 lines
44 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 KANAMI_SKILL_SW = 329;
var Spriteset_Clicker = /** @class */ (function (_super) {
__extends(Spriteset_Clicker, _super);
function Spriteset_Clicker() {
var _this = _super.call(this) || this;
_this._animationSprites = [];
_this._spriteCharacterList = [];
if ($slg.formation().isChanged()) {
if ($slg.clickerStage().enemyId() >= 1) {
$slg.clicker().start($slg.clickerStage().enemyId());
}
$slg.formation().clearChanged();
}
_this.setup($slg.clickerStage());
_this._blackScreen.opacity = 0;
_this.update();
return _this;
}
Spriteset_Clicker.prototype.removeAnimation = function (sprite) {
this._animationSprites.remove(sprite);
if (this._effectsContainer) {
this._effectsContainer.removeChild(sprite);
}
for (var _i = 0, _a = sprite.targetObjects; _i < _a.length; _i++) {
var target = _a[_i];
if (target && target.endAnimation) {
target.endAnimation();
}
}
sprite.destroy();
};
Spriteset_Clicker.prototype.updatePosition = function () {
var screen = $gameScreen;
var scale = screen.zoomScale();
this.scale.x = scale;
this.scale.y = scale;
this.x = this.battleFieldX();
this.y = this.battleFieldY();
this.x += Math.round(screen.shake());
};
Spriteset_Clicker.prototype.battleFieldX = function () {
return Graphics.width - 300;
};
Spriteset_Clicker.prototype.battleFieldY = function () {
return 44;
};
Spriteset_Clicker.prototype.setup = function (clickerStage) {
this._clickerStage = clickerStage;
if (!this._clickerStage.inBattle()) {
return;
}
this.createBg();
this.createBg2();
this.createField();
this.createUnits();
this.createLabel();
this.createFrontLine();
this.createLeader();
this.createSkill();
this.createBackButton();
this.removeChild(this._effectsContainer);
this._effectsContainer = new Sprite();
this.addChild(this._effectsContainer);
};
Spriteset_Clicker.prototype.createPictures = function () {
// do nothing
};
Spriteset_Clicker.prototype.createSkill = function () {
var s = new Sprite_ClickerSkill($slg.clicker().skill());
this.addChild(s);
this._leaderSprite.setClickHandler(this.onSkill.bind(this));
};
Spriteset_Clicker.prototype.onSkill = function () {
if (!$slg.clicker().skill().invoke()) {
return;
}
var n = 0;
for (
var _i = 0, _a = $slg.formation().aliveTargets();
_i < _a.length;
_i++
) {
var b = _a[_i];
b.onLeaderSkill(n);
n++;
}
$gameSwitches.setValue(KANAMI_SKILL_SW, true);
SoundManager.playUseSkill();
this._leaderSprite.onInvoke();
var skillSpeed = $slg.clicker().skillSpeed();
if (skillSpeed >= 2) {
$slg.clicker().currentStage().attackLeader();
}
};
Spriteset_Clicker.prototype.createBackButton = function () {
var button = new Sprite_Button2("back");
button.x = 224;
button.y = 0;
this.addChild(button);
button.setClickHandler(this.onBack.bind(this));
this._backButton = button;
};
Spriteset_Clicker.prototype.createLabel = function () {
this._nameSprite = new Sprite_PlaceName();
this.addChild(this._nameSprite);
this._nameSprite.showName(this._clickerStage);
};
Spriteset_Clicker.prototype.onBack = function () {
$slg.clicker().escape();
};
Spriteset_Clicker.prototype.findTargetSprite = function (target) {
if (target == $gamePlayer) {
return _super.prototype.findTargetSprite.call(this, target);
}
return target;
};
Spriteset_Clicker.prototype.createField = function () {
this._bgSprite = new Sprite();
this.addChild(this._bgSprite);
this.createEnemies();
};
Spriteset_Clicker.prototype.createBg = function () {
this.removeChild(this._bgSprite);
var sprite = new Sprite();
var mapId = this._clickerStage.mapId();
sprite.bitmap = ImageManager.loadBattleback1("map_" + mapId.padZero(2));
this.addChild(sprite);
this._bgSprite = sprite;
this._inWaitBg = !sprite.bitmap.isReady();
};
Spriteset_Clicker.prototype.createBg2 = function () {
this.removeChild(this._bgSprite2);
var baseTexture = Nore.getSystemBaseTexture("main");
var r = new Rectangle(0, 400, 300, 377);
var texture = new PIXI.Texture(baseTexture, r);
var s = new PIXI.Sprite(texture);
s.x = 2;
s.y = 379;
this._bgSprite2 = s;
this.addChild(s);
};
Spriteset_Clicker.prototype.createEnemies = function () {
this._enemySpriteList = [];
this._enemyHpList = [];
var enemyList = this._clickerStage.enemyList();
if (!enemyList) {
return;
}
var index = 0;
var offsetX = enemyList.length == 1 ? 84 : 2;
for (var _i = 0, enemyList_1 = enemyList; _i < enemyList_1.length; _i++) {
var m = enemyList_1[_i];
var s = new Sprite_ClickerEnemy();
s.setup(m, index, -60, offsetX + 15);
this.addChild(s);
this._enemySpriteList.push(s);
var hpSprite = new Sprite_ClickerEnemyHp(m);
hpSprite.x = index * 150 + 20 + offsetX;
hpSprite.y = 330;
this._enemyHpList.push(hpSprite);
this.addChild(hpSprite);
index++;
}
};
Spriteset_Clicker.prototype.createFrontLine = function () {
this.removeChild(this._line);
var line = new PIXI.Graphics();
line.beginFill(0x2189ff, 1);
line.drawRect(0, 0, 3, 800);
line.endFill();
this.addChild(line);
this._line = line;
};
Spriteset_Clicker.prototype.update = function () {
if ($gameSwitches.value(28)) {
return;
}
_super.prototype.update.call(this);
this.updateNewStage();
this.updateVisible();
if (!this._clickerStage) {
return;
}
this.updateBg();
this.updateDamage();
this.updateEnemyDamage();
this.updateRecoverHp();
this.updateButtonVisible();
};
Spriteset_Clicker.prototype.updateButtonVisible = function () {
if ($slg.clickerStage().isBattleEnd()) {
if (this._backButton) {
this._backButton.visible = false;
}
}
};
Spriteset_Clicker.prototype.updateChangeUnits = function () {
var battleMembers = $slg.formation().battleMembers();
if (this._spriteCharacterList.length != battleMembers.length) {
this.createUnits();
return;
}
for (var i = 0; i < battleMembers.length; i++) {
var m = battleMembers[i];
var s = this._spriteCharacterList[i];
if (m != s.battleActor()) {
this.createUnits();
return;
}
}
};
Spriteset_Clicker.prototype.updateNewStage = function () {
var currentStage = $slg.clickerStage();
if (this._clickerStage != currentStage) {
this.setup(currentStage);
}
};
Spriteset_Clicker.prototype.updateBg = function () {
if (!this._inWaitBg) {
return;
}
var mapId = this._clickerStage.mapId();
this._bgSprite.bitmap = ImageManager.loadBattleback1(
"map_" + mapId.padZero(2)
);
this._inWaitBg = !this._bgSprite.bitmap.isReady();
};
Spriteset_Clicker.prototype.updateVisible = function () {
if (!this._clickerStage) {
this.visible = false;
return;
}
if (this._clickerStage.enemyId() == -1) {
this.visible = false;
return;
}
this.visible = !this.isHideSideBattle();
};
Spriteset_Clicker.prototype.isHideSideBattle = function () {
if ($gameSwitches.value(17)) {
return false;
}
if ($gameSwitches.value(42)) {
return true;
}
if ($gameSwitches.value(31)) {
// 吹き出し表示中
return !$gameSwitches.value(SHOW_SIDE_BATTLE_SW);
}
if ($gameMap._interpreter.isRunning()) {
if (!this._interWait) {
this._interWait = 1;
} else {
this._interWait++;
if (this._interWait >= 4) {
if (!$gameMap._interpreter.isRunning()) {
this._interWait = 0;
}
return true;
}
}
} else {
this._interWait = 0;
}
return !$gameSwitches.value(SHOW_SIDE_BATTLE_SW);
};
Spriteset_Clicker.prototype.createUnits = function () {
for (var _i = 0, _a = this._spriteCharacterList; _i < _a.length; _i++) {
var c = _a[_i];
this.removeChild(c);
}
this._spriteCharacterList = [];
var index = 0;
var battleMemberSize = $slg.formation().existBattleMembers().length;
for (
var _b = 0, _c = $slg.formation().existBattleMembers();
_b < _c.length;
_b++
) {
var unit = _c[_b];
if (!unit) {
continue;
}
var c = new ClickerCharacter(unit, index, battleMemberSize);
var s = new Sprite_ClickerActor(c);
this.addChild(s);
this._spriteCharacterList.push(s);
var hpSprite = new Sprite_ClickerActorHp(unit);
hpSprite.x = c.screenX() - 18;
this.addChild(hpSprite);
index++;
}
};
Spriteset_Clicker.prototype.createLeader = function () {
var skillSpeed = $slg.clicker().skillSpeed();
this._leaderSprite = new Sprite_ClickerLeader(
$slg.clicker().skill(),
skillSpeed
);
this.addChild(this._leaderSprite);
};
Spriteset_Clicker.prototype.updateRecoverHp = function () {
for (
var _i = 0, _a = $slg.formation().existBattleMembers();
_i < _a.length;
_i++
) {
var m = _a[_i];
var recoverValue = m.getRecoverHp();
m.clearRecoverHp();
if (recoverValue > 0) {
var c = this.findSpriteCharacter(m);
var s = new Sprite_ClickerRecover(recoverValue, c);
this.addChild(s);
}
}
};
Spriteset_Clicker.prototype.updateDamage = function () {
for (
var _i = 0, _a = this._clickerStage.damageList();
_i < _a.length;
_i++
) {
var d = _a[_i];
this.addDamage(d);
}
this._clickerStage.clearDamage();
};
Spriteset_Clicker.prototype.updateEnemyDamage = function () {
for (
var _i = 0, _a = this._clickerStage.enemyDamageList();
_i < _a.length;
_i++
) {
var d = _a[_i];
this.addEnemyDamage(d);
}
this._clickerStage.clearEnemyDamage();
};
Spriteset_Clicker.prototype.addDamage = function (d) {
var c = this.findSpriteCharacter(d.battleActor());
if (!c) {
//return;
}
var enemySprite = this.findEnemySprite(d.enemy());
//$gameTemp.requestAnimation([this._enemySprite], 66, false);
var s = new Sprite_ClickerDamage(d, c, enemySprite);
this.addChild(s);
if (c) {
c.attack();
}
$gameTemp.requestAnimation(
[enemySprite],
this.getAnimeId(d.animationId()),
false
);
};
Spriteset_Clicker.prototype.addEnemyDamage = function (d) {
var e = d.enemy();
if (!e) {
return;
}
var c = this.findSpriteCharacter(d.battleActor());
if (!c) {
return;
}
//$gameTemp.requestAnimation([this._enemySprite], 66, false);
var s = new Sprite_EnemyClickerDamage(d, c);
this.addChild(s);
var sprite = this.findEnemySprite(e);
if (sprite) {
sprite.attack();
}
var animeId = d.animeId();
if (animeId == d.defaultAnimeId()) {
animeId = this._clickerStage.enemyAttackAnimeId();
}
$gameTemp.requestAnimation([c], this.getAnimeId(animeId), false);
};
Spriteset_Clicker.prototype.findEnemySprite = function (enemy) {
for (var _i = 0, _a = this._enemySpriteList; _i < _a.length; _i++) {
var s = _a[_i];
if (s.enemy() == enemy) {
return s;
}
}
return null;
};
Spriteset_Clicker.prototype.findSpriteCharacter = function (battleActor) {
for (var _i = 0, _a = this._spriteCharacterList; _i < _a.length; _i++) {
var c = _a[_i];
if (c.battleActor() == battleActor) {
return c;
}
}
};
Spriteset_Clicker.prototype.getAnimeId = function (id) {
if (ConfigManager.battleSe) {
return id;
} else {
return id + 100;
}
};
return Spriteset_Clicker;
})(Spriteset_Base);
var Sprite_PlaceName = /** @class */ (function (_super) {
__extends(Sprite_PlaceName, _super);
function Sprite_PlaceName() {
var _this = _super.call(this) || this;
_this.bitmap = new Bitmap(250, 50);
return _this;
}
Sprite_PlaceName.prototype.showName = function (stage) {
this.bitmap.clear();
this.bitmap.outlineWidth = 5;
this.bitmap.outlineColor = "#000000";
this.bitmap.drawText(stage.name(), 10, 3, 220, 30);
};
return Sprite_PlaceName;
})(Sprite);
var Sprite_ClickerEnemy = /** @class */ (function (_super) {
__extends(Sprite_ClickerEnemy, _super);
function Sprite_ClickerEnemy() {
var _this = _super.call(this) || this;
_this._baseY = 0;
_this._offsetX = 0;
_this._offsetY = 0;
_this._moveSpeed = 0;
_this.anchor.x = 0.5;
_this.anchor.y = 1;
return _this;
}
Sprite_ClickerEnemy.prototype.setup = function (
enemy,
index,
baseY,
offsetX
) {
this._enemy = enemy;
this._index = index;
this._baseY = baseY;
this._offsetX = offsetX;
this._appeared = enemy.isAlive();
this.updateImage();
this.updatePosition();
this.updateOutline();
this.updateVisible();
};
Sprite_ClickerEnemy.prototype.updateVisible = function () {
if (!this._enemy.isAlive()) {
this.visible = false;
}
};
Sprite_ClickerEnemy.prototype.updateOutline = function () {
var filter3 = new PIXI.filters.OutlineFilter(3, this.pixiColor());
this.filters = [filter3];
};
Sprite_ClickerEnemy.prototype.pixiColor = function () {
switch (this._enemy.element()) {
case MonsterElement.flame:
return MonsterElementColor.flame;
case MonsterElement.water:
return MonsterElementColor.water;
case MonsterElement.wood:
return MonsterElementColor.wood;
}
return 0x888888;
};
Sprite_ClickerEnemy.prototype.enemy = function () {
return this._enemy;
};
Sprite_ClickerEnemy.prototype.update = function () {
_super.prototype.update.call(this);
if (!this._enemy) {
return;
}
this.updateEffect();
if (!this._enemy.isAlive()) {
//this.visible = false;
if (this._effectDuration == 0) {
this.visible = false;
}
return;
}
if (!this.bitmap || !this.bitmap.isReady()) {
this.updateImage();
}
this.updatePosition();
this.move();
};
Sprite_ClickerEnemy.prototype.updateEffect = function () {
this.setupEffect();
if (this._effectDuration > 0) {
this._effectDuration--;
switch (this._effectType) {
case "collapse":
this.updateCollapse();
break;
case "bossCollapse":
//this.updateBossCollapse();
break;
}
if (this._effectDuration === 0) {
this._effectType = null;
}
}
};
Sprite_ClickerEnemy.prototype.setupEffect = function () {
if (this._appeared && !this._enemy.isAlive()) {
this.startCollapse();
}
};
Sprite_ClickerEnemy.prototype.startCollapse = function () {
SoundManager.playEnemyCollapse();
this._effectType = "collapse";
this._effectDuration = 32;
this._appeared = false;
};
Sprite_ClickerEnemy.prototype.updateCollapse = function () {
this.blendMode = 1;
this.setBlendColor([255, 128, 128, 128]);
this.opacity *= this._effectDuration / (this._effectDuration + 1);
};
Sprite_ClickerEnemy.prototype.updateImage = function () {
if (!this._enemy) {
this.bitmap = null;
return;
}
this.bitmap = ImageManager.loadEnemy(this._enemy.battlerName());
};
Sprite_ClickerEnemy.prototype.updatePosition = function () {
if (!this.bitmap) {
return;
}
this.x = this._index * 150 + this._offsetX + 50;
this.y = 400 - this._offsetY + this._baseY;
};
Sprite_ClickerEnemy.prototype.move = function () {
if (this._attack) {
this._offsetY -= this._moveSpeed;
this._moveSpeed--;
if (this._moveSpeed <= 1) {
this._attack = false;
}
return;
}
if (this._offsetY < 0) {
this._offsetY += 2;
if (this._offsetY > 0) {
this._offsetY = 0;
}
}
};
Sprite_ClickerEnemy.prototype.attack = function () {
this._attack = true;
this._moveSpeed = 5;
};
return Sprite_ClickerEnemy;
})(Sprite);
var ClickerCharacter = /** @class */ (function () {
function ClickerCharacter(battleActor, index, battleMemberSize) {
this._x = 0;
this._y = 0;
this._pattern = 0;
this._direction = 2;
this._opacity = 255;
this._animationCount = 0;
this._transparent = false;
this._offsetY = 0;
this._moveSpeed = 0;
this._battleActor = battleActor;
this._actorId = battleActor.actorId();
this._index = index;
this._battleMemberSize = battleMemberSize;
}
ClickerCharacter.prototype.id = function () {
return this._id;
};
ClickerCharacter.prototype.actor = function () {
var actor = $gameActors.actor(this._actorId);
if (!actor) {
console.error("actorが見つかりません:" + this._actorId);
}
return actor;
};
ClickerCharacter.prototype.characterName = function () {
return this._battleActor.characterName();
};
ClickerCharacter.prototype.characterIndex = function () {
return this._battleActor.characterIndex();
};
ClickerCharacter.prototype.pattern = function () {
return this._pattern < 3 ? this._pattern : 1;
};
ClickerCharacter.prototype.updateAnimation = function () {
this.updateAnimationCount();
if (this._animationCount >= this.animationWait()) {
this.updatePattern();
this._animationCount = 0;
}
};
ClickerCharacter.prototype.animationWait = function () {
return 12;
};
ClickerCharacter.prototype.updateAnimationCount = function () {
this._animationCount++;
};
ClickerCharacter.prototype.updatePattern = function () {
this._pattern = (this._pattern + 1) % this.maxPattern();
};
ClickerCharacter.prototype.maxPattern = function () {
return 4;
};
ClickerCharacter.prototype.direction = function () {
return 8;
};
ClickerCharacter.prototype.opacity = function () {
return this._opacity;
};
ClickerCharacter.prototype.blendMode = function () {
return 0;
};
ClickerCharacter.prototype.bushDepth = function () {
return 0;
};
ClickerCharacter.prototype.x = function () {
return this._x;
};
ClickerCharacter.prototype.y = function () {
return this._y;
};
ClickerCharacter.prototype.atk = function () {
return this.actor().atk;
};
ClickerCharacter.prototype.isTransparent = function () {
return this._transparent;
};
ClickerCharacter.prototype.tileId = function () {
return 0;
};
ClickerCharacter.prototype.screenX = function () {
if (this._battleMemberSize == 5) {
return this._index * 52 + 44;
} else {
return this._index * 62 + 44;
}
};
ClickerCharacter.prototype.screenY = function () {
return this.homeY() + this.offsetY();
};
ClickerCharacter.prototype.homeY = function () {
return 474;
};
ClickerCharacter.prototype.offsetY = function () {
this._offsetY = this._offsetY || 0;
return this._offsetY;
};
ClickerCharacter.prototype.screenZ = function () {
return 1;
};
ClickerCharacter.prototype.battleActor = function () {
return this._battleActor;
};
ClickerCharacter.prototype.update = function () {
this.move();
this.updateAnimation();
};
ClickerCharacter.prototype.move = function () {
if (this._attack) {
this._offsetY -= this._moveSpeed;
this._moveSpeed--;
if (this._moveSpeed <= 1) {
this._attack = false;
}
return;
}
if (this._offsetY < 0) {
this._offsetY += 2;
if (this._offsetY > 0) {
this._offsetY = 0;
}
}
};
ClickerCharacter.prototype.attack = function () {
this._attack = true;
this._moveSpeed = 6;
};
return ClickerCharacter;
})();
var Sprite_ClickerActor = /** @class */ (function (_super) {
__extends(Sprite_ClickerActor, _super);
function Sprite_ClickerActor(c) {
var _this = _super.call(this, c) || this;
_this._clickerCharacter = c;
_this.updateOutline();
return _this;
}
Sprite_ClickerActor.prototype.battleActor = function () {
return this._clickerCharacter.battleActor();
};
Sprite_ClickerActor.prototype.updateOutline = function () {
var filter3 = new PIXI.filters.OutlineFilter(3, this.pixiColor());
this.filters = [filter3];
};
Sprite_ClickerActor.prototype.pixiColor = function () {
switch (this.battleActor().element()) {
case MonsterElement.flame:
return MonsterElementColor.flame;
case MonsterElement.water:
return MonsterElementColor.water;
case MonsterElement.wood:
return MonsterElementColor.wood;
}
return 0x888888;
};
Sprite_ClickerActor.prototype.attack = function () {
this._clickerCharacter.attack();
};
Sprite_ClickerActor.prototype.update = function () {
_super.prototype.update.call(this);
if (this._clickerCharacter.battleActor().isDead()) {
this.visible = false;
} else {
this.visible = true;
}
this._clickerCharacter.update();
};
return Sprite_ClickerActor;
})(Sprite_Character);
var Sprite_ClickerEnemyHp = /** @class */ (function (_super) {
__extends(Sprite_ClickerEnemyHp, _super);
function Sprite_ClickerEnemyHp(enemy) {
var _this = _super.call(this) || this;
_this._enemy = enemy;
_this.bitmap = new Bitmap(300, 44);
_this.refresh();
return _this;
}
Sprite_ClickerEnemyHp.prototype.update = function () {
_super.prototype.update.call(this);
if (
this._lastHp != this._enemy.hp() ||
this._lastWait != this._enemy.wait()
) {
this.refresh();
}
};
Sprite_ClickerEnemyHp.prototype.refresh = function () {
this.bitmap.clear();
this._lastHp = this._enemy.hp();
this._lastWait = this._enemy.wait();
this.drawHp();
this.drawTime();
};
Sprite_ClickerEnemyHp.prototype.drawHp = function () {
var ww = 80;
var hh = 10;
var y = 20;
var x = 0;
this.bitmap.drawText(this._enemy.hp() + "", ww, y, 45, 20, "right");
var mhp = this._enemy.mhp();
if (!(mhp > 0)) {
return;
}
var hp = this._lastHp;
if (isNaN(hp)) {
return;
}
this.bitmap.fillRect(x, y, ww + 4, hh + 4, this.whiteColor());
this.bitmap.fillRect(x + 1, y + 1, ww + 2, hh + 2, "#000000");
this.bitmap.gradientFillRect(
x + 2,
y + 2,
(hp * ww) / mhp,
hh,
ColorManager.hpGaugeColor2(),
ColorManager.hpGaugeColor1()
);
};
Sprite_ClickerEnemyHp.prototype.drawTime = function () {
var maxWait = this._enemy.maxWait();
var wait = this._lastWait;
if (isNaN(wait)) {
return;
}
if (isNaN(maxWait) || maxWait <= 0) {
return;
}
var ww = 80;
var hh = 3;
var y = 20 + 12;
var x = 0;
this.bitmap.fillRect(x, y, ww + 4, hh + 3, this.whiteColor());
this.bitmap.fillRect(x + 1, y, ww + 2, hh + 2, "#000000");
if (this._lastHp <= 0) {
return;
}
this.bitmap.gradientFillRect(
x + 2,
y + 1,
(wait * ww) / maxWait,
hh,
ColorManager.mpGaugeColor2(),
ColorManager.mpGaugeColor1()
);
};
Sprite_ClickerEnemyHp.prototype.whiteColor = function () {
return "#BBBBBB";
};
return Sprite_ClickerEnemyHp;
})(Sprite);
var Sprite_ClickerActorHp = /** @class */ (function (_super) {
__extends(Sprite_ClickerActorHp, _super);
function Sprite_ClickerActorHp(actor) {
var _this = _super.call(this) || this;
_this._actor = actor;
_this.bitmap = new Bitmap(300, 90);
_this.refresh();
_this.y = 469;
return _this;
}
Sprite_ClickerActorHp.prototype.update = function () {
_super.prototype.update.call(this);
if (
this._lastHp != this._actor.hp() ||
this._lastWait != this._actor.wait()
) {
this.refresh();
}
};
Sprite_ClickerActorHp.prototype.refresh = function () {
this._lastHp = this._actor.hp();
this._lastWait = this._actor.wait();
this.bitmap.clear();
this.drawHp();
this.drawTime();
if (true) {
this.drawAtk();
}
};
Sprite_ClickerActorHp.prototype.drawHp = function () {
var ww = 40;
var hh = 6;
var y = 16;
this.bitmap.drawText(this._actor.hp() + "", 0, y + 10, 40, 30, "right");
var mhp = this._actor.mhp();
if (!(mhp > 0)) {
return;
}
var hp = this._lastHp;
if (isNaN(hp)) {
return;
}
// this.bitmap.fillRect(0, y, ww + 2, hh + 2, '#000000');
this.bitmap.gradientFillRect(
1,
y + 1,
(hp * ww) / mhp,
hh,
ColorManager.hpGaugeColor2(),
ColorManager.hpGaugeColor1()
);
};
Sprite_ClickerActorHp.prototype.drawTime = function () {
var ww = 40;
var hh = 3;
var y = 23;
var wait = this._actor.wait();
var maxWait = this._actor.maxWait();
if (maxWait <= 0 || isNaN(maxWait)) {
return;
}
// this.bitmap.fillRect(0, y, ww + 2, hh + 2, '#000000');
this.bitmap.gradientFillRect(
1,
y + 1,
((maxWait - wait) * ww) / maxWait,
hh,
ColorManager.mpGaugeColor2(),
ColorManager.mpGaugeColor1()
);
};
Sprite_ClickerActorHp.prototype.drawAtk = function () {
//this.bitmap.drawText(this._actor.atk() + '', 0, 60, 40, 30, 'right');
};
return Sprite_ClickerActorHp;
})(Sprite);
var Sprite_ClickerDamage = /** @class */ (function (_super) {
__extends(Sprite_ClickerDamage, _super);
function Sprite_ClickerDamage(damage, c, e) {
var _this = _super.call(this) || this;
_this._damage = damage;
_this.bitmap = new Bitmap(80, 30);
if (_this.isLeader(c)) {
_this.drawLeaderDamage();
} else {
_this.drawZakoDamage(c, e);
}
_this._wait = 90;
_this._speedX = _this.randomSpeedX();
_this._speedY = 0;
_this._acceY = 0.3;
return _this;
}
Sprite_ClickerDamage.prototype.isLeader = function (c) {
return c == null;
};
Sprite_ClickerDamage.prototype.drawLeaderDamage = function () {
this.bitmap.textColor = ColorManager.normalColor();
this.bitmap.outlineColor = "#FF0000";
this.bitmap.fontBold = true;
this.bitmap.fontSize = 28;
this.bitmap.drawText(this._damage.damage() + "", 0, 0, 80, 30);
this.x = 90;
this.y = 200 + 30;
};
Sprite_ClickerDamage.prototype.drawZakoDamage = function (c, e) {
if (!e) {
return;
}
this.bitmap.textColor = this.textColor(this._damage.element());
this.bitmap.outlineColor = this.outLineColor(this._damage.element());
this.bitmap.fontBold = true;
if (this._damage.isWeak()) {
this.bitmap.fontSize = 28;
} else {
this.bitmap.fontSize = 14;
}
this.bitmap.drawText(this._damage.damage() + "", 0, 0, 60, 30, "right");
this.x = e.x - 50;
this.y = 200 + 90;
};
Sprite_ClickerDamage.prototype.outLineColor = function (element) {
switch (element) {
case MonsterElement.flame:
return MonsterElementStringColor.flame;
case MonsterElement.water:
return MonsterElementStringColor.water;
case MonsterElement.wood:
return MonsterElementStringColor.wood;
}
return "#333333";
};
Sprite_ClickerDamage.prototype.textColor = function (element) {
switch (element) {
case MonsterElement.flame:
return "#FF9999";
case MonsterElement.water:
return "#9999FF";
case MonsterElement.wood:
return "#99FF99";
}
return "#FFFFFF";
};
Sprite_ClickerDamage.prototype.randomSpeedX = function () {
return (Math.random() - 0.5) * 6;
};
Sprite_ClickerDamage.prototype.update = function () {
_super.prototype.update.call(this);
//this.move();
this.moveUp();
this.updateWait();
this.updateOpacity();
};
Sprite_ClickerDamage.prototype.updateWait = function () {
if (this._wait > 0) {
this._wait--;
if (this._wait == 0) {
if (this.parent) {
this.parent.removeChild(this);
}
}
}
};
Sprite_ClickerDamage.prototype.updateOpacity = function () {
if (this._wait < 60) {
this.opacity -= 6;
}
};
Sprite_ClickerDamage.prototype.moveUp = function () {
this.y -= 2;
};
Sprite_ClickerDamage.prototype.move = function () {
this.x += this._speedX;
this._speedY += this._acceY;
this.y += this._speedY;
};
return Sprite_ClickerDamage;
})(Sprite);
var Sprite_EnemyClickerDamage = /** @class */ (function (_super) {
__extends(Sprite_EnemyClickerDamage, _super);
function Sprite_EnemyClickerDamage(damage, c) {
var _this = _super.call(this) || this;
_this._damage = damage;
_this.bitmap = new Bitmap(80, 30);
_this.drawZakoDamage(c);
_this._wait = 90;
_this._speedX = _this.randomSpeedX();
_this._speedY = 0;
_this._acceY = 0.3;
return _this;
}
Sprite_EnemyClickerDamage.prototype.drawZakoDamage = function (c) {
this.bitmap.textColor = this.textColor(this._damage.element());
this.bitmap.outlineColor = this.outLineColor(this._damage.element());
this.bitmap.fontBold = true;
if (this._damage.isWeak()) {
this.bitmap.fontSize = 28;
} else {
this.bitmap.fontSize = 14;
}
this.bitmap.drawText(this._damage.damage() + "", 0, 0, 40, 30, "right");
this.x = c.x - 24;
this.y = c.y - 30;
};
Sprite_EnemyClickerDamage.prototype.randomSpeedX = function () {
return (Math.random() - 0.5) * 6;
};
Sprite_EnemyClickerDamage.prototype.outLineColor = function (element) {
/*switch (element) {
case MonsterElement.flame: return MonsterElementStringColor.flame;
case MonsterElement.water: return MonsterElementStringColor.water;
case MonsterElement.wood: return MonsterElementStringColor.wood;
}
return '#333333';*/
return MonsterElementStringColor.flame;
};
Sprite_EnemyClickerDamage.prototype.textColor = function (element) {
/*switch (element) {
case MonsterElement.flame: return '#FF9999';
case MonsterElement.water: return '#9999FF';
case MonsterElement.wood: return '#99FF99';
}
return '#FFFFFF';*/
return "#FFFFFF";
};
Sprite_EnemyClickerDamage.prototype.update = function () {
_super.prototype.update.call(this);
//this.move();
this.moveUp();
this.updateWait();
this.updateOpacity();
};
Sprite_EnemyClickerDamage.prototype.updateWait = function () {
if (this._wait > 0) {
this._wait--;
if (this._wait == 0) {
if (this.parent) {
this.parent.removeChild(this);
}
}
}
};
Sprite_EnemyClickerDamage.prototype.updateOpacity = function () {
if (this._wait < 60) {
this.opacity -= 6;
}
};
Sprite_EnemyClickerDamage.prototype.moveUp = function () {
this.y -= 1;
};
Sprite_EnemyClickerDamage.prototype.move = function () {
this.x += this._speedX;
this._speedY += this._acceY;
this.y += this._speedY;
};
return Sprite_EnemyClickerDamage;
})(Sprite);
var Sprite_ClickerRecover = /** @class */ (function (_super) {
__extends(Sprite_ClickerRecover, _super);
function Sprite_ClickerRecover(value, c) {
var _this = _super.call(this) || this;
_this._value = value;
_this.bitmap = new Bitmap(80, 30);
_this._wait = 90;
_this._speedX = _this.randomSpeedX();
_this._speedY = 0;
_this._acceY = 0.3;
_this.drawHp(c);
return _this;
}
Sprite_ClickerRecover.prototype.isLeader = function (c) {
return c == null;
};
Sprite_ClickerRecover.prototype.drawHp = function (c) {
this.bitmap.textColor = ColorManager.normalColor();
this.bitmap.outlineColor = "#00FF00";
this.bitmap.fontBold = true;
this.bitmap.fontSize = 14;
this.bitmap.drawText(this._value + "", 0, 0, 80, 30);
this.x = c.x;
this.y = c.y - 30;
};
Sprite_ClickerRecover.prototype.randomSpeedX = function () {
return (Math.random() - 0.5) * 6;
};
Sprite_ClickerRecover.prototype.update = function () {
_super.prototype.update.call(this);
//this.move();
this.moveUp();
this.updateWait();
this.updateOpacity();
};
Sprite_ClickerRecover.prototype.updateWait = function () {
if (this._wait > 0) {
this._wait--;
if (this._wait == 0) {
if (this.parent) {
this.parent.removeChild(this);
}
}
}
};
Sprite_ClickerRecover.prototype.updateOpacity = function () {
if (this._wait < 60) {
this.opacity -= 6;
}
};
Sprite_ClickerRecover.prototype.moveUp = function () {
this.y -= 1;
};
Sprite_ClickerRecover.prototype.move = function () {
this.x += this._speedX;
this._speedY += this._acceY;
this.y += this._speedY;
};
return Sprite_ClickerRecover;
})(Sprite);
var BalloonType;
(function (BalloonType) {
BalloonType[(BalloonType["clear"] = 0)] = "clear";
BalloonType[(BalloonType["ready"] = 1)] = "ready";
BalloonType[(BalloonType["invoke"] = 2)] = "invoke";
})(BalloonType || (BalloonType = {}));
var Sprite_ClickerLeadarBalloon = /** @class */ (function (_super) {
__extends(Sprite_ClickerLeadarBalloon, _super);
function Sprite_ClickerLeadarBalloon() {
var _this = _super.call(this) || this;
_this.bitmap = new Bitmap(200, 200);
_this.bitmap.outlineWidth = 6;
_this.bitmap.outlineColor = "rgba(0, 0, 0, 0.7)";
return _this;
}
Sprite_ClickerLeadarBalloon.prototype.drawBalloon = function () {
this.bitmap.clear();
var bitmap = ImageManager.loadSystem("main");
this.bitmap.blt(bitmap, 265, 74, 180, 100, 0, 0);
};
Sprite_ClickerLeadarBalloon.prototype.drawReady = function () {
this.drawBalloon();
this._type = BalloonType.ready;
var y = 2;
if ($gameSwitches.value(KANAMI_SKILL_SW)) {
y += 20;
}
if (ConfigManager.language == "en") {
y += 60;
}
var bitmap = ImageManager.loadSystem("main");
this.bitmap.blt(bitmap, 298, 209 + y, 140, 20, 28, 32);
this.clearDirty();
};
Sprite_ClickerLeadarBalloon.prototype.drawInvoke = function () {
this.drawBalloon();
this._type = BalloonType.invoke;
var y = 42;
if (ConfigManager.language == "en") {
y += 60;
}
var bitmap = ImageManager.loadSystem("main");
this.bitmap.blt(bitmap, 298, 209 + y, 140, 20, 28, 32);
this.clearDirty();
};
Sprite_ClickerLeadarBalloon.prototype.clear = function () {
this._type = BalloonType.clear;
this.clearDirty();
this.bitmap.clear();
};
Sprite_ClickerLeadarBalloon.prototype.update = function () {
_super.prototype.update.call(this);
this.redraw();
};
Sprite_ClickerLeadarBalloon.prototype.redraw = function () {
if (this._dirty) {
this.clearDirty();
switch (this._type) {
case BalloonType.ready:
this.drawReady();
break;
case BalloonType.invoke:
this.drawInvoke();
break;
}
}
};
Sprite_ClickerLeadarBalloon.prototype.clearDirty = function () {
this._dirty = false;
};
return Sprite_ClickerLeadarBalloon;
})(Sprite);
var Sprite_ClickerLeader = /** @class */ (function (_super) {
__extends(Sprite_ClickerLeader, _super);
function Sprite_ClickerLeader(skill, skillSpeed) {
var _this = _super.call(this) || this;
_this._skill = skill;
_this._skillSpeed = skillSpeed;
_this.x = -40;
_this.y = 360;
_this.width = 400;
_this.height = 300;
_this._actor = JsonEx.makeDeepCopy($gameActors.actor(10));
_this.createBalloon();
return _this;
}
Sprite_ClickerLeader.prototype.createBalloon = function () {
this._balloon = new Sprite_ClickerLeadarBalloon();
this._balloon.clear();
this._balloon.x = 4;
this._balloon.y = 160;
};
Sprite_ClickerLeader.prototype.update = function () {
_super.prototype.update.call(this);
//this.move();
this.updateFace();
};
Sprite_ClickerLeader.prototype.setClickHandler = function (method) {
this._clickHandler = method;
};
Sprite_ClickerLeader.prototype.hitTest = function (x, y) {
var rect = new Rectangle(50, 170, this.width, this.height);
return rect.contains(x, y);
};
Sprite_ClickerLeader.prototype.onInvoke = function () {
this._invokeWait = 60;
this._balloon.drawReady();
};
Sprite_ClickerLeader.prototype.onPress = function () {
if (this.parent) {
if (this.parent.parent) {
if (!this.parent.parent.visible) {
return;
}
}
}
if (this._clickHandler) {
this._clickHandler.call(this);
}
};
Sprite_ClickerLeader.prototype.updateFace = function () {
var face = this.faceId();
if (face != this._lastFace) {
this.refresh(face);
}
};
Sprite_ClickerLeader.prototype.faceId = function () {
if (!this._skill) {
return 1;
}
if (this._invokeWait > 0) {
this._invokeWait--;
if (this._invokeWait == 0) {
this._balloon.clear();
}
return this.invokeFaceId();
}
if (this._skill.isActive()) {
return this.activeFaceId();
}
return 1;
};
Sprite_ClickerLeader.prototype.invokeFaceId = function () {
if (this._skillSpeed >= 2) {
return 11;
}
return 2;
};
Sprite_ClickerLeader.prototype.activeFaceId = function () {
if (this._skillSpeed >= 2) {
return 6;
}
return 17;
};
Sprite_ClickerLeader.prototype.refresh = function (faceId) {
this.removeChildren();
if (faceId == this.invokeFaceId()) {
this._balloon.drawInvoke();
} else if (faceId == this.activeFaceId()) {
this._balloon.drawReady();
} else if (this._skillSpeed == 2) {
faceId = 15;
}
if (this._lastFace) {
if (this._lastFace != faceId) {
if (faceId == this.activeFaceId()) {
AudioManager.playSe({
name: "FCPC1_SE15_Select15",
volume: 80,
pitch: 120,
pan: 0,
});
}
}
}
this._lastFace = faceId;
this.drawActor();
this.addChild(this._balloon);
};
Sprite_ClickerLeader.prototype.drawActor = function () {
var xx = -28;
var yy = -92;
if (this._skillSpeed == 2) {
this._actor.setHightlight(Hightlight.none);
this._actor.showOutline = true;
if (this._actor.outerId == "b") {
this._actor.setPoseId(7);
xx = -30 + 72;
yy = 30 + 40;
var r = new Rectangle(50, 150, 300, 300);
$gameActors.actor(89).showOutline = true;
this.drawTachieActor(
$gameActors.actor(89),
this,
xx,
yy,
null,
this._lastFace,
0.54
);
return;
}
}
this.drawTachieActor(this._actor, this, xx, yy, null, this._lastFace, 0.74);
};
Sprite_ClickerLeader.prototype.move = function () {
if (this._attack) {
this._offsetY -= this._moveSpeed;
this._moveSpeed--;
if (this._moveSpeed <= 1) {
this._attack = false;
}
return;
}
if (this._offsetY < 0) {
this._offsetY += 2;
if (this._offsetY > 0) {
this._offsetY = 0;
}
}
};
Sprite_ClickerLeader.prototype.attack = function () {
this._attack = true;
this._moveSpeed = 6;
};
return Sprite_ClickerLeader;
})(Sprite_Clickable);
var Sprite_ClickerSkill = /** @class */ (function (_super) {
__extends(Sprite_ClickerSkill, _super);
function Sprite_ClickerSkill(skill) {
var _this = _super.call(this) || this;
_this._skill = skill;
_this._clickHandler = null;
_this._coldFrame = null;
_this._hotFrame = null;
//this.setupFrames();
_this.setUpTimeSprite();
_this.y = 716;
_this.x = 100;
return _this;
}
Sprite_ClickerSkill.prototype.setUpTimeSprite = function () {
this._timeSprite = new Sprite_ClickerSkillTime(this._skill);
this._timeSprite.x = -20;
this._timeSprite.y = 20;
this.addChild(this._timeSprite);
};
Sprite_ClickerSkill.prototype.setupFrames = function () {
var data = this.buttonData();
var x = data.x * this.blockWidth();
var y = data.y * this.blockHeight();
var width = this.blockWidth();
var height = this.blockHeight();
this.loadButtonImage();
this.setColdFrame(x, y, width, height);
this.setHotFrame(x, y + 32, width, height);
this.updateFrame();
this.updateOpacity();
};
Sprite_ClickerSkill.prototype.blockWidth = function () {
return 32;
};
Sprite_ClickerSkill.prototype.blockHeight = function () {
return 32;
};
Sprite_ClickerSkill.prototype.loadButtonImage = function () {
this.bitmap = ImageManager.loadSystem("IconSet");
};
Sprite_ClickerSkill.prototype.buttonData = function () {
var iconIndex = this.buttonIndex();
var x = iconIndex % 16;
var y = Math.floor(iconIndex / 16);
return { x: x, y: y };
};
Sprite_ClickerSkill.prototype.buttonIndex = function () {
switch (this._skill.type()) {
case ClickerSkillType.speedUp:
return 46;
case ClickerSkillType.attack:
return 35;
}
return 1;
};
Sprite_ClickerSkill.prototype.update = function () {
_super.prototype.update.call(this);
// this.processTouch();
};
Sprite_ClickerSkill.prototype.updateFrame = function () {
var frame = this.isPressed() ? this._hotFrame : this._coldFrame;
if (frame) {
this.setFrame(frame.x, frame.y, frame.width, frame.height);
}
};
Sprite_ClickerSkill.prototype.updateOpacity = function () {
this.opacity = 255; //this._pressed ? 255 : 192;
};
Sprite_ClickerSkill.prototype.setColdFrame = function (x, y, width, height) {
this._coldFrame = new Rectangle(x, y, width, height);
};
Sprite_ClickerSkill.prototype.setHotFrame = function (x, y, width, height) {
this._hotFrame = new Rectangle(x, y, width, height);
};
Sprite_ClickerSkill.prototype.setClickHandler = function (method) {
this._clickHandler = method;
};
Sprite_ClickerSkill.prototype.onClick = function () {
if (this._clickHandler) {
this._clickHandler();
} else {
//Input.virtualClick(this._buttonType);
}
};
return Sprite_ClickerSkill;
})(Sprite_Clickable);
var Sprite_ClickerSkillTime = /** @class */ (function (_super) {
__extends(Sprite_ClickerSkillTime, _super);
function Sprite_ClickerSkillTime(skill) {
var _this = _super.call(this) || this;
_this._skill = skill;
_this.refresh();
return _this;
}
Sprite_ClickerSkillTime.prototype.update = function () {
_super.prototype.update.call(this);
if (this._skill.remain() != this._lastRemain) {
this.refresh();
}
};
Sprite_ClickerSkillTime.prototype.refresh = function () {
this.removeChildren();
var s = this.getGaugeBackSprite();
this.addChild(s);
this._lastRemain = this._skill.remain();
if (this._skill.isActive()) {
this.refreshActive();
} else {
this.refreshCooling();
}
};
Sprite_ClickerSkillTime.prototype.barWidth = function () {
return 142;
};
Sprite_ClickerSkillTime.prototype.barHeight = function () {
return 5;
};
Sprite_ClickerSkillTime.prototype.refreshActive = function () {
var gaugeSprite = this.getGaugeSprite(1, 1);
this.addChild(gaugeSprite);
};
Sprite_ClickerSkillTime.prototype.refreshCooling = function () {
var gaugeSprite = this.getGaugeSprite(0, this._skill.timeRate());
this.addChild(gaugeSprite);
};
Sprite_ClickerSkillTime.prototype.getGaugeSprite = function (index, rate) {
var baseTexture = Nore.getSystemBaseTexture("main");
var r = new Rectangle(0, 320 + index * 28, Math.floor(127 * rate), 20);
var texture = new PIXI.Texture(baseTexture, r);
var s = new PIXI.Sprite(texture);
s.x = 4;
s.y = 3;
return s;
};
Sprite_ClickerSkillTime.prototype.getGaugeBackSprite = function () {
var baseTexture = Nore.getSystemBaseTexture("main");
var r = new Rectangle(0, 170, 140, 20);
var texture = new PIXI.Texture(baseTexture, r);
return new PIXI.Sprite(texture);
};
return Sprite_ClickerSkillTime;
})(Sprite);