back_recharge
wangyuan 2019-06-13 20:46:12 +08:00
parent 378eadb7c1
commit 2348065005
1 changed files with 8 additions and 5 deletions

View File

@ -192,12 +192,15 @@ public class MapManager extends MongoBase {
int recoveryTime = SGameSetting.getGameSetting().getRecoveryTime();
int heroTimes = SGameSetting.getGameSetting().getHeroTimes();
int recoveryTimes = (updateTime - lastUpdateEnergyTime)/recoveryTime;
if(itemNum<heroTimes && recoveryTimes>0){
int addValue = MathUtils.setBetweenWithMax(itemNum+recoveryTimes,0,heroTimes);
if(addValue!=0){
item.setItemNum(addValue);
setLastUpdateEnergyTime(item, updateTime, lastUpdateEnergyTime);
if( recoveryTimes>0){
if(itemNum<heroTimes ){
int addValue = MathUtils.setBetweenWithMax(itemNum+recoveryTimes,0,heroTimes);
if(addValue!=0){
item.setItemNum(addValue);
}
}
int time = lastUpdateEnergyTime + recoveryTimes*recoveryTime;
item.setEndingTime(time);
}
}