新将活动应策划需求改版,掉落比例重新计算
parent
686596375d
commit
c1fcfcf3a2
|
@ -24,6 +24,7 @@ import manager.STableManager;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/***
|
||||
* @author hj
|
||||
|
@ -57,7 +58,7 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
|
|||
// 读表
|
||||
int monsterGroupId = newHeroConfig.getMonsterGroup(); //怪物id
|
||||
int bossBlood = 0; //怪物血量
|
||||
int[][] hurt = newHeroConfig.getDropList(); //伤害奖励表
|
||||
int[][] hurtList = newHeroConfig.getDropCell(); //伤害奖励表
|
||||
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(monsterGroupId);
|
||||
// 获取怪物组
|
||||
|
@ -101,16 +102,20 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
|
|||
String blood = numberFormat.format((float) checkResult[1] / (float)bossBlood);
|
||||
// 表里面配置的伤害是万分比,所以这里的概率乘以10000
|
||||
float b = Float.parseFloat(blood)*10000;
|
||||
|
||||
// 获取奖励id
|
||||
int[] dropList = new int[hurt.length];
|
||||
for (int i=0;i<hurt.length;i++){
|
||||
float h = hurt[i][0];
|
||||
if (b >= h){
|
||||
dropList[i] = hurt[i][1];
|
||||
}
|
||||
}
|
||||
int[] dropList = new int[1];
|
||||
|
||||
// 道具逻辑,封装好的
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropList,1,0, BIReason.NEW_GENERAL_ATTACK);
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
|
||||
for (int i = 0; i < hurtList.length; i++) {
|
||||
// 当前类型奖励次数
|
||||
float v = b / hurtList[i][0];
|
||||
dropList[0] = hurtList[i][1];
|
||||
ItemUtil.drop(user, dropList,drop,v,0, BIReason.NEW_GENERAL_ATTACK);
|
||||
System.out.println();
|
||||
}
|
||||
// 消耗道具
|
||||
PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ public class ItemUtil {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static CommonProto.Drop.Builder drop(User user, int[] dropGroupIds,float dropRatio, int isMapping,int reason) throws Exception {
|
||||
public static CommonProto.Drop.Builder drop(User user, int[] dropGroupIds,float dropRatio, int isMapping,int reason) throws Exception {
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||
Map<Integer, Integer> cardMap = new HashMap<>();
|
||||
|
@ -249,6 +249,27 @@ public class ItemUtil {
|
|||
return dropBuilder;
|
||||
}
|
||||
|
||||
public static CommonProto.Drop.Builder drop(User user, int[] dropGroupIds,CommonProto.Drop.Builder dropBuilder,float dropRatio, int isMapping,int reason) throws Exception {
|
||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||
Map<Integer, Integer> cardMap = new HashMap<>();
|
||||
Map<Integer, Integer> equipMap = new HashMap<>();
|
||||
Map<Integer,Integer> randomMap = new HashMap<>();
|
||||
ItemMap itemObj = new ItemMap();
|
||||
|
||||
combineRewardDropGroup(user, dropGroupIds, dropRatio, itemMap, cardMap, equipMap, randomMap,itemObj);
|
||||
useRandomItem(user,randomMap,reason);
|
||||
if (isMapping == 1) {
|
||||
addItemToTemporaryBag(user, itemMap, equipMap, dropBuilder);
|
||||
} else {
|
||||
addItem(user,itemMap,dropBuilder,reason);
|
||||
addEquip(user,equipMap,dropBuilder,reason);
|
||||
addSpecialMonster(user,itemObj,dropBuilder,reason);
|
||||
|
||||
}
|
||||
addCard(user,cardMap,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param user
|
||||
* @param dropGroupIds
|
||||
|
|
Loading…
Reference in New Issue