文档库 最新最全的文档下载
当前位置:文档库 › 黑兵 登陆前输入 爱微游 勇士之塔 代码

黑兵 登陆前输入 爱微游 勇士之塔 代码

var mhp = 1e+200; //兵的血量,值越大越多血。1e+200就是10的200次方
var xing_zou_su_du = 10; //行走速度

si=setInterval(function (){
b=UserProxy.getInstance().getHeroInfo();
b.speed=xing_zou_su_du;b.maxhp=mhp;},1000);
var herorate = 1; //1为全部出黑兵,2则1个黑兵,1个勇者。
var myhero = 0;
UserProxy.getInstance().createHero = function(){myhero++;if(myhero==herorate){myhero=0;return true;}else{return false;}};

//隐藏所有勇士或者兵
var TowerView = function (d) {
function f(b) {
d.call(this);
this._chaList = [];
this._monsterList = [null, null, null, null, null];
this._monsterPosList = [];
this._floor = b;
this._monsterCount = UserProxy.getInstance().battleField[this._floor - 1].length;
switch (this._monsterCount) {
case 1:
this._monsterPosList.push(180);
break;
case 2:
this._monsterPosList.push(240, 170);
break;
case 3:
this._monsterPosList.push(275, 220, 165);
break;
case 4:
this._monsterPosList.push(320, 265, 210, 155);
break;
case 5:
this._monsterPosList.push(340, 290, 240,
190, 140)
}
for (b = 0; b < this._monsterCount; b++)
this.addMonster(b, !1)
}
__extends(f, d);
var g = f.prototype;
g.restore = function () {
for (var b in this._chaList)
this._chaList[b].restore()
};
Object.defineProperty(g, "floor", {
get : function () {
return this._floor
},
enumerable : !0,
configurable : !0
});
Object.defineProperty(g, "direction", {
get : function () {
return 0 < this._floor % 2
},
enumerable : !0,
configurable : !0
});
g.createMonsterId = function () {
return 125 < this._floor ? Math.floor(80 * Math.random()) + 50 : Math.floor(5 * Math.random()) + this._floor
};
g.addMonster = function (b, d) {
var a = UserProxy.getInstance().popTreasure(10 * (this._floor - 1) + b),
c = new Monster(a ? 1E3 : this.createMonsterId(), this._floor, b, d);
this._monsterList[b] = c;
this.direction ? (c.scaleX = 1, c.x = this._monsterPosList[b]) : (c.scaleX = -1, c.x = 480 - this._monsterPosList[b]);
this.addChild(c);
var f = UserProxy.getInstance().battleField[this._floor - 1][b];
c.maxhp = f.maxhp;
c.atk = f.attack;
a ? (c.coin = a, c.isTreasure = !0) : (c.coin = f.coin, c.isTreasure = !1);
return c
};
g.initCha = function (b) {
b.floor = this._floor;
b.enabled =
!0;
this._chaList.push(b);
this.addChild(b)
};
g.addCha = function (b) {
var d = !1;
if (1E3 == b) {
var d = UserProxy.getInstance().createHero(),
a = new egret.MovieClip(Global.getBombFactory().generateMovieClipData("bomb"));
a.touchEnabled = !1;
this.addChild(a);
a.x = this.direction ? f.DEST_POS[1] : f.DEST_POS[0];
a.y = 55;
a.play();
a.addEventListener(https://www.wendangku.net/doc/2e8559889.html,PLETE, function (c) {
a.removeEventListener(https://www.wendangku.net/doc/2e8559889.html,PLETE,
arguments.callee, a);
DisplayUtils.removeFromParent(a)
}, a)

}
var c = null,
c = 3E3 == b ? new Character(3E3, this._floor) : new Character(d ? 2E3 : b, this._floor);
if (1E3 == b) {
b = UserProxy.getInstance().getHeroInfo();
var h = UserProxy.getInstance().getWeaponParam(7);
d ? (UserProxy.getInstance().lhBorn++, c.maxhp = 3 * b.maxhp * (h ? 1 + 0.01 * h : 1), c.atk = 5 * b.attack * (h ? 1 + 0.01 * h : 1), c.speed = 2 * b.speed, Notice.show("\u53ec\u5524\u51fa\u4e86\u5df4\u8428\u5361", 16776960)) : (UserProxy.getInstance().shBorn++, c.maxhp = b.maxhp, c.atk = b.attack, c.speed =
b.speed)
} else
3E3 == b ? (c.maxhp = 1, c.atk = UserProxy.getInstance().demonAttack, c.speed = 5) : (h = UserProxy.getInstance().getWeaponParam(36), d = UserProxy.getInstance().getSoldierData(b), UserProxy.getInstance().skillProb && this.floor > UserProxy.getInstance().curFloor + 1 ? (c.maxhp = Math.floor(8 * d.maxhp * (1 + 0.01 * h)), c.atk = Math.floor(1.5 * d.attack * (1 + 0.01 * h))) : (c.maxhp = d.maxhp, c.atk = d.attack), c.speed = d.speed);
this.initCha(c)
};
g.upCha = function (b) {
this.initCha(b);
egret.Tween.get(b).to({
alpha : 1
}, 250)
};
g.removeCha = function (b) {
b.parent ==
this ? (this.removeChild(b), this._chaList.splice(this._chaList.indexOf(b), 1)) : console.log("[Error removeCha]chafloor: " + b.floor + ", towerfloor:" + this.floor)
};
g.monsterDead = function (b) {
b.die();
this.dropGold(b);
this._monsterList[b.index] = null;
b.index == this._monsterCount - 1 && EventManager.getInstance().dispatch(ContextEvent.FLOOR_CLEAN, this._floor)
};
g.dropGold = function (b) {
for (var d = b.isTreasure, a = 0; a < (d ? 8 : 3); a++) {
var c = new DropGold(b.x, 90, d);
this.addChild(c)
}
var d = Math.floor(b.coin * (1 + 0.01 * UserProxy.getInstance().skillGoldUp)),
f = new egret.TextField;
f.anchorX = 0.5;
f.anchorY = 0.5;
f.textAlign = egret.HorizontalAlign.CENTER;
f.verticalAlign = egret.VerticalAlign.MIDDLE;
f.textColor = 16776960;
f.fontFamily = Global.SYS_FONT;
f.size = 16;
f.bold = !0;
f.text = MathUtils.easyNumber(d);
f.x = b.x;
f.y = 70;
f.alpha = 0.3;
egret.Tween.get(f).to({
y : 58,
alpha : 1
}, 200, egret.Ease.bounceOut).wait(500).call(function () {
DisplayUtils.removeFromParent(f);
EventManager.getInstance().dispatch(ContextEvent.REFRESH_BASE)
}, f);
UserProxy.getInstance().gold += d;
UserProxy.getInstance().sendGold +=
d;
this.addChild(f)
};
g.update = function (b) {
var d = [],
a;
for (a in this._chaList) {
var c = this._chaList[a];
if (c.enabled)
for (var h = 0; h < this._monsterList.length; h++) {
var g = this._monsterList[h];
if (g && g.enabled && !c.hitIndex) {
g.damage(c.atk);
c.hitMonster(g);
break
}
}

}
for (h = 0; h < this._monsterList.length; h++)
(g = this._monsterList[h]) && g.enabled && g.update(b);
c = UserProxy.getInstanc

e().getWeaponParam(6);
b = 250 - Math.floor(Math.min(2.5 *
c, 150));
h = 500 - Math.floor(Math.min(6 * c, 400));
for (a in d)
c = d[a], c.enabled = !1, c.stop(), egret.Tween.get(c).to({
alpha : 0
}, b).wait(h).call(function () {
EventManager.getInstance().dispatch(ContextEvent.UP_CHA, this)
}, c)
};
g.destory = function () {
for (var b in this._monsterList)
this._monsterList[b] && this._monsterList[b].destory();
var d = this._chaList.concat();
for (b in d)
EventManager.getInstance().dispatch(ContextEvent.CHA_DEAD, d[b]);
this._chaList.length = 0
};
f.DEST_POS = [68, 410];
return f
}
(egret.DisplayObjectContainer);
TowerView.prototype.__class__ = "TowerView";

相关文档
相关文档 最新文档