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 recoveryTime = SGameSetting.getGameSetting().getRecoveryTime();
int heroTimes = SGameSetting.getGameSetting().getHeroTimes(); int heroTimes = SGameSetting.getGameSetting().getHeroTimes();
int recoveryTimes = (updateTime - lastUpdateEnergyTime)/recoveryTime; int recoveryTimes = (updateTime - lastUpdateEnergyTime)/recoveryTime;
if(itemNum<heroTimes && recoveryTimes>0){ if( recoveryTimes>0){
int addValue = MathUtils.setBetweenWithMax(itemNum+recoveryTimes,0,heroTimes); if(itemNum<heroTimes ){
if(addValue!=0){ int addValue = MathUtils.setBetweenWithMax(itemNum+recoveryTimes,0,heroTimes);
item.setItemNum(addValue); if(addValue!=0){
setLastUpdateEnergyTime(item, updateTime, lastUpdateEnergyTime); item.setItemNum(addValue);
}
} }
int time = lastUpdateEnergyTime + recoveryTimes*recoveryTime;
item.setEndingTime(time);
} }
} }