Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,420 @@
|
||||
package net.pixvi.myr.element.boss
|
||||
{
|
||||
import net.pixvi.myr.center.BossCenter;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.center.TimeCenter;
|
||||
import net.pixvi.myr.element.cost.CostVo;
|
||||
import net.pixvi.myr.element.reward.RewardVo;
|
||||
import net.pixvi.myr.util.MyrCalendar;
|
||||
import net.pixvi.pfw.utils.Counter;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
|
||||
public class BossVo
|
||||
{
|
||||
|
||||
public var bossId:String = "1001";
|
||||
|
||||
public var name:String = "";
|
||||
|
||||
public var totalHp:Number = 1000000000;
|
||||
|
||||
public var currentHp:Number = 0;
|
||||
|
||||
public var showHp:Number = -1;
|
||||
|
||||
public var startTime:Number = 0;
|
||||
|
||||
public var endTime:Number = 0;
|
||||
|
||||
public var getRewardTime:Number = 0;
|
||||
|
||||
public var getReward:Boolean = false;
|
||||
|
||||
public var huntTime:Number = 0;
|
||||
|
||||
public var damage:Number = 0;
|
||||
|
||||
public var huntNumCount:int = 0;
|
||||
|
||||
public var damageCount:Number = 0;
|
||||
|
||||
public var prevLocalCheckTime:Number;
|
||||
|
||||
public var noticed:Boolean = false;
|
||||
|
||||
public var preNoticed:Boolean = false;
|
||||
|
||||
public var updateOver:Boolean = false;
|
||||
|
||||
public var status:int = 0;
|
||||
|
||||
public var gotoReward:Boolean = false;
|
||||
|
||||
public function BossVo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function table() : Object
|
||||
{
|
||||
return Table.boss_info[bossId];
|
||||
}
|
||||
|
||||
public function get des() : String
|
||||
{
|
||||
return table().des;
|
||||
}
|
||||
|
||||
public function get overMsg() : String
|
||||
{
|
||||
return table().overMsg;
|
||||
}
|
||||
|
||||
public function get rewardImg() : String
|
||||
{
|
||||
return table().rewardImg;
|
||||
}
|
||||
|
||||
public function get helpScript() : String
|
||||
{
|
||||
return table().helpScript;
|
||||
}
|
||||
|
||||
public function get maxNum() : int
|
||||
{
|
||||
return table().maxNum;
|
||||
}
|
||||
|
||||
public function get preNotice() : String
|
||||
{
|
||||
return (table().preNotice as String).replace("{name}",Paster.font(name,"#ffcc00"));
|
||||
}
|
||||
|
||||
public function get notice() : String
|
||||
{
|
||||
return (table().notice as String).replace("{name}",Paster.font(name,"#ffcc00"));
|
||||
}
|
||||
|
||||
public function getLeftNum() : int
|
||||
{
|
||||
var n:int = int((TimeCenter.timestamp - huntTime) / cd);
|
||||
if(n > maxNum)
|
||||
{
|
||||
n = maxNum;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
public function get maxDamage() : Number
|
||||
{
|
||||
return table().maxDamage;
|
||||
}
|
||||
|
||||
public function get cd() : int
|
||||
{
|
||||
return table().cd;
|
||||
}
|
||||
|
||||
public function get battleCost() : CostVo
|
||||
{
|
||||
var co:CostVo = new CostVo();
|
||||
co.setByVo(table().battleCost);
|
||||
return co;
|
||||
}
|
||||
|
||||
public function get battleReward() : RewardVo
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get element() : int
|
||||
{
|
||||
return table().element;
|
||||
}
|
||||
|
||||
public function get totalDamageReward() : Array
|
||||
{
|
||||
return totalDamageReward;
|
||||
}
|
||||
|
||||
public function getRewardByTotalDamage(totalDamage:Number) : RewardVo
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get position() : Object
|
||||
{
|
||||
if(table() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return table().position;
|
||||
}
|
||||
|
||||
public function setData(data:Object) : void
|
||||
{
|
||||
this.bossId = data.bossId;
|
||||
this.name = data.name;
|
||||
this.totalHp = data.totalHp;
|
||||
this.currentHp = this.showHp = data.currentHp;
|
||||
this.startTime = int(data.startTime / 1000);
|
||||
this.endTime = int(data.endTime / 1000);
|
||||
}
|
||||
|
||||
public function setHuntInfo(data:Object = null) : void
|
||||
{
|
||||
if(data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.huntTime = int(data.huntTime / 1000);
|
||||
this.getRewardTime = int(data.getRewardTime / 1000);
|
||||
this.getReward = data.getReward == 1;
|
||||
this.damage = data.damage;
|
||||
}
|
||||
|
||||
public function get isGetReward() : Boolean
|
||||
{
|
||||
return MyrCalendar.getDayNumber(getRewardTime * 1000) == MyrCalendar.getDayNumber();
|
||||
}
|
||||
|
||||
public function get closeMsg() : String
|
||||
{
|
||||
return table().closeMsg;
|
||||
}
|
||||
|
||||
public function get pointMsg() : String
|
||||
{
|
||||
return table().pointMsg;
|
||||
}
|
||||
|
||||
public function get pointName() : String
|
||||
{
|
||||
return table().pointName;
|
||||
}
|
||||
|
||||
public function getImg() : String
|
||||
{
|
||||
return table().battle[getMode()].img;
|
||||
}
|
||||
|
||||
public function getWildImg() : void
|
||||
{
|
||||
return table().wildImg;
|
||||
}
|
||||
|
||||
public function getMode() : int
|
||||
{
|
||||
var i:int = 0;
|
||||
var sc:Number = currentHp / totalHp;
|
||||
for(i = 0; i < table().battle.length; )
|
||||
{
|
||||
if(sc >= table().battle[i].process)
|
||||
{
|
||||
return table().battle[i].mode;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
public function getShowMode() : int
|
||||
{
|
||||
var i:int = 0;
|
||||
var sc:Number = showHp / totalHp;
|
||||
for(i = 0; i < table().battle.length; )
|
||||
{
|
||||
if(sc >= table().battle[i].process)
|
||||
{
|
||||
return table().battle[i].mode;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
public function hasDamage() : Boolean
|
||||
{
|
||||
if(MyrCalendar.getDayNumber() != MyrCalendar.getDayNumber(huntTime * 1000))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hasGetReward() : Boolean
|
||||
{
|
||||
if(MyrCalendar.getDay(getRewardTime) == MyrCalendar.getDay())
|
||||
{
|
||||
return getReward;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isOver() : Boolean
|
||||
{
|
||||
if(TimeCenter.timestamp > endTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get linkBoss() : Array
|
||||
{
|
||||
return table().linkBoss;
|
||||
}
|
||||
|
||||
public function isShow() : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
var linkb:BossVo = null;
|
||||
for(i = 0; i < linkBoss.length; )
|
||||
{
|
||||
linkb = BossCenter.getIns().getBossByBossId(linkBoss[i]);
|
||||
if(linkb.currentHp >= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(isOver())
|
||||
{
|
||||
if(hasDamage())
|
||||
{
|
||||
if(getReward)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if(TimeCenter.timestamp <= endTime && TimeCenter.timestamp >= startTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function cdLeft() : int
|
||||
{
|
||||
return cd - (TimeCenter.timestamp - huntTime) % cd;
|
||||
}
|
||||
|
||||
public function getHpScale() : Number
|
||||
{
|
||||
var startValue:Number = NaN;
|
||||
var curMode:int = getMode();
|
||||
if(curMode == 3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(curMode == 0)
|
||||
{
|
||||
startValue = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
startValue = Number(table().battle[curMode - 1].process);
|
||||
}
|
||||
var endValue:Number = Number(table().battle[curMode].process);
|
||||
return Counter.getAreaByArea(0,1,startValue,endValue,currentHp / totalHp,true);
|
||||
}
|
||||
|
||||
public function get finishTitle() : String
|
||||
{
|
||||
return table().finishTitle;
|
||||
}
|
||||
|
||||
public function get finishContent() : String
|
||||
{
|
||||
return table().finishContent;
|
||||
}
|
||||
|
||||
public function getShowHpScale() : Number
|
||||
{
|
||||
var startValue:Number = NaN;
|
||||
var curMode:Number = getShowMode();
|
||||
if(curMode == 0)
|
||||
{
|
||||
startValue = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
startValue = Number(table().battle[curMode - 1].process);
|
||||
}
|
||||
var endValue:Number = Number(table().battle[curMode].process);
|
||||
return Counter.getAreaByArea(0,1,startValue,endValue,showHp / totalHp,true);
|
||||
}
|
||||
|
||||
public function costTi() : int
|
||||
{
|
||||
return table().battleCost.ti;
|
||||
}
|
||||
|
||||
public function getCurBattle() : Object
|
||||
{
|
||||
var mode:int = getMode();
|
||||
for each(var o:Object in table().battle)
|
||||
{
|
||||
if(o.mode == mode)
|
||||
{
|
||||
return o.battle;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get hitMovs() : Array
|
||||
{
|
||||
return table().hitMov;
|
||||
}
|
||||
|
||||
public function needNotice() : Boolean
|
||||
{
|
||||
if(TimeCenter.timestamp >= startTime && TimeCenter.timestamp <= endTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function finishLink() : Boolean
|
||||
{
|
||||
var i:int = 0;
|
||||
var linkb:BossVo = null;
|
||||
for(i = 0; i < linkBoss.length; )
|
||||
{
|
||||
linkb = BossCenter.getIns().getBossByBossId(linkBoss[i]);
|
||||
if(linkb.currentHp >= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function needPreNotice() : Boolean
|
||||
{
|
||||
if(TimeCenter.timestamp >= startTime - 3600 * 0.5 && TimeCenter.timestamp < startTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get rankId() : String
|
||||
{
|
||||
return table().rankId;
|
||||
}
|
||||
|
||||
public function getDamageMsg(bossDamage:int) : String
|
||||
{
|
||||
var msg:String = table().damageMsg;
|
||||
return msg.replace("{damage}",Paster.font(bossDamage.toString(),"#ffcc00"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user