新将打点和奖励计算修改
parent
3d388fcf32
commit
98967d13ce
|
@ -13,6 +13,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.fight.*;
|
import com.ljsd.jieling.logic.fight.*;
|
||||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||||
|
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.util.ItemUtil;
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
import config.SMonsterConfig;
|
import config.SMonsterConfig;
|
||||||
|
@ -59,6 +60,7 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
|
||||||
|
|
||||||
// 读表
|
// 读表
|
||||||
int monsterGroupId = newHeroConfig.getMonsterGroup(); //怪物id
|
int monsterGroupId = newHeroConfig.getMonsterGroup(); //怪物id
|
||||||
|
int monsterId = 0;
|
||||||
double bossBlood = 0.0; //怪物血量
|
double bossBlood = 0.0; //怪物血量
|
||||||
int[][] hurtList = newHeroConfig.getDropCell(); //伤害奖励表
|
int[][] hurtList = newHeroConfig.getDropCell(); //伤害奖励表
|
||||||
|
|
||||||
|
@ -73,6 +75,7 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
|
||||||
// 怪物不存在
|
// 怪物不存在
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
monsterId = ints[j];
|
||||||
SMonsterConfig monsterConfig = STableManager.getConfig(SMonsterConfig.class).get(ints[j]);
|
SMonsterConfig monsterConfig = STableManager.getConfig(SMonsterConfig.class).get(ints[j]);
|
||||||
// 计算总血量
|
// 计算总血量
|
||||||
bossBlood+=monsterConfig.getHp();
|
bossBlood+=monsterConfig.getHp();
|
||||||
|
@ -102,11 +105,9 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
|
||||||
int[] checkResult = fightResult.getCheckResult();
|
int[] checkResult = fightResult.getCheckResult();
|
||||||
|
|
||||||
double lessBlood = 0.0;
|
double lessBlood = 0.0;
|
||||||
int hurtResult = 0;
|
|
||||||
// checkResult第一位输赢,1赢,其他输
|
// checkResult第一位输赢,1赢,其他输
|
||||||
if (checkResult[0] == 1){
|
if (checkResult[0] == 1){
|
||||||
lessBlood = bossBlood;
|
lessBlood = bossBlood;
|
||||||
hurtResult = checkResult[1];
|
|
||||||
}else {
|
}else {
|
||||||
// checkResult第三位开始为血量,下标0开始
|
// checkResult第三位开始为血量,下标0开始
|
||||||
for (int i = 2; i < checkResult.length; i++) {
|
for (int i = 2; i < checkResult.length; i++) {
|
||||||
|
@ -128,21 +129,26 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
|
||||||
|
|
||||||
// 道具逻辑,封装好的
|
// 道具逻辑,封装好的
|
||||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||||
// 战报返回
|
|
||||||
List<String> dropResult = new ArrayList<>();
|
|
||||||
|
|
||||||
for (int i = 0; i < hurtList.length; i++) {
|
for (int i = 0; i < hurtList.length; i++) {
|
||||||
// 当前类型奖励次数
|
// 当前类型奖励次数
|
||||||
float v = b / hurtList[i][0];
|
int v = (int)b / hurtList[i][0];
|
||||||
dropList[0] = hurtList[i][1];
|
dropList[0] = hurtList[i][1];
|
||||||
ItemUtil.drop(user, dropList,drop,v,0, BIReason.NEW_GENERAL_ATTACK);
|
ItemUtil.drop(user, dropList,drop,v,0, BIReason.NEW_GENERAL_ATTACK);
|
||||||
dropResult.add(dropList[0] + "#" + v);
|
|
||||||
}
|
}
|
||||||
// 消耗道具
|
// 消耗道具
|
||||||
PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
||||||
|
|
||||||
|
// 战报记录,奖励信息
|
||||||
|
List<String> dropResult = new ArrayList<>();
|
||||||
|
List<CommonProto.Item> list = drop.build().getItemlistList();
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
String str = list.get(i).getItemId() + "#" + list.get(i).getItemNum();
|
||||||
|
dropResult.add(str);
|
||||||
|
}
|
||||||
|
|
||||||
// 埋点
|
// 埋点
|
||||||
ReportUtil.onReportEvent(user, ReportEventEnum.VANQUISH_BOSS.getType(), monsterGroupId,checkResult[0],hurtResult,dropResult);
|
ReportUtil.onReportEvent(user, ReportEventEnum.VANQUISH_BOSS.getType(), monsterId,(int)lessBlood,dropResult);
|
||||||
|
|
||||||
return ActivityProto.NewGeneralAttackResponse.newBuilder().setFightData(fightData).setDrop(drop).build();
|
return ActivityProto.NewGeneralAttackResponse.newBuilder().setFightData(fightData).setDrop(drop).build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ public enum ReportEventEnum {
|
||||||
ARENA_CHALLENGE(66,"arena_challenge",CommonEventHandler.getInstance(),new String[]{"battle_result","own_integral_num","rewards_num","own_new_integral_num","own_ranking","role_id","enemy_integral_num","new_enemy_integral_num","enemy_ranking","hero1","hero2","hero3","hero4","hero5","hero6","attack_pokemon","defend_hero1","defend_hero2","defend_hero3","defend_hero4","defend_hero5","defend_hero6","defend_pokemon"}),
|
ARENA_CHALLENGE(66,"arena_challenge",CommonEventHandler.getInstance(),new String[]{"battle_result","own_integral_num","rewards_num","own_new_integral_num","own_ranking","role_id","enemy_integral_num","new_enemy_integral_num","enemy_ranking","hero1","hero2","hero3","hero4","hero5","hero6","attack_pokemon","defend_hero1","defend_hero2","defend_hero3","defend_hero4","defend_hero5","defend_hero6","defend_pokemon"}),
|
||||||
CEREMONY(67,"ceremony",CommonEventHandler.getInstance(),new String[]{"cost_item_id","integral_num","new_integral_num","own_ranking","guild_ranking"}),
|
CEREMONY(67,"ceremony",CommonEventHandler.getInstance(),new String[]{"cost_item_id","integral_num","new_integral_num","own_ranking","guild_ranking"}),
|
||||||
TREASURE_SUMMON(68,"treasure_summon",CommonEventHandler.getInstance(),new String[]{"beast_id","summon_type","cost_item_id","cost_amount","reward_nums_list"}),// 降妖夺宝
|
TREASURE_SUMMON(68,"treasure_summon",CommonEventHandler.getInstance(),new String[]{"beast_id","summon_type","cost_item_id","cost_amount","reward_nums_list"}),// 降妖夺宝
|
||||||
VANQUISH_BOSS(69,"vanquish_boss",CommonEventHandler.getInstance(),new String[]{"boss_id","battle_result","damage_num","reward_nums_list"}),// 新将来袭
|
VANQUISH_BOSS(69,"vanquish_boss",CommonEventHandler.getInstance(),new String[]{"boss_id","damage_num","reward_nums_list"}),// 新将来袭
|
||||||
VIP_LEVEL_UP(100,"", new VipLevelUpEventHandler(),new String[]{""});
|
VIP_LEVEL_UP(100,"", new VipLevelUpEventHandler(),new String[]{""});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue