private void propertyKill() { _battleStatus = CMsgHeader.STATUS_PROPERTY_KILL; float[] proMul = BT_WarUtils.propertyVs(_curAtter._property, _curDefer._property); if (proMul[0] > 1) { //无视属性克制 if (_curDefer.shouldCastIgnorePropertyKill()) { return; } } if (proMul[1] > 1) { //无视属性克制 if (_curAtter.shouldCastIgnorePropertyKill()) { return; } } _curAtter.curAttEnhance(proMul[0]); if (_isWorldBoss == 0)//不是世界boss { _curDefer.curAttEnhance(proMul[1]); } CMsgPropertyEnchance msg = new CMsgPropertyEnchance(proMul[0], proMul[1], _curAtter.curAtt, _curDefer.curAtt); addMsgToRecorder(msg); }
private void castSkillOp4() { float damage = param.rate * Consts.oneHundred * owner.curAtt; // 最少造成1点伤害 if (damage <= 0) { damage = 1; } int extra = 0; if (BT_WarUtils.happen(param.gailv)) { extra++; } castAttackComboSkill(damage, extra); }
/// <summary> /// Generates the video.生成战斗的录像数据 /// </summary> private string generateVideo() { #if Video StringBuilder video = new StringBuilder(); foreach (CMsgHeader msg in _warRecorder) { if (msg != null) { video.Append(BT_WarUtils.ToJson(msg)); } } string flat = video.ToString(); //会自动Base64 string compressed = Framework.DeflateEx.Compress(flat); return(compressed); #else //只记录下登场回合的信息 StringBuilder video = new StringBuilder(); foreach (CMsgHeader msg in _warRecorder) { if (msg != null && msg.status == CMsgHeader.STATUS_ROUND_BEGIN) { video.Append(BT_WarUtils.ToJson(msg)).Append(","); } } string flat = video.ToString(); if (!string.IsNullOrEmpty(flat)) { int length = flat.Length; if (length > 1) { flat = flat.Substring(0, length - 1); } } flat = "[" + flat + "]"; ConsoleEx.DebugLog(flat, ConsoleEx.RED); return(flat); #endif }
// TODO: 复活技能. // type: 0--随机复活 1--从前向后 2--从后到前 private void castReviveSkill(int num, int type, int angryCost = 0) { BT_MonsterTeam selfTeam = owner.ownerTeam; // 扣怒气... if (angryCost > 0) { selfTeam.costAngry(angryCost); } List <BT_Monster> dieArr = new List <BT_Monster>(); List <BT_Monster> sortDieArry = new List <BT_Monster>(); foreach (BT_Monster pet in selfTeam._team) { if (pet == owner) { break; } if (!pet.alive) { dieArr.Add(pet); } } int tataoDieCount = dieArr.Count; if (tataoDieCount >= 1) { if (0 == type) { BT_WarUtils.Shuffle(dieArr); type = 1; } int minCount = tataoDieCount > num ? num : tataoDieCount; for (int j = 0; j < minCount; j++) { sortDieArry.Add(dieArr [j]); } sortDieArry.Sort(my_sort); BT_Logical war = owner._war; CMsgSkillRevive msg = new CMsgSkillRevive(this); war.addMsgToRecorder(msg); msg.reviveArr = new int[minCount]; for (int i = 0; i < minCount; i++) { BT_Monster pet = type == 1 ? array_shift(sortDieArry) : array_pop(sortDieArry); if (pet != null) { pet.revive(); selfTeam._team.Add(pet); msg.reviveArr [i] = pet.pveId; } } selfTeam.teamLenChanged(); } else { //如果没有人死亡,则奥义的技能就算没触发过 if (real == 1) { BT_Logical war = owner._war; war.resetAoYi(this, selfTeam); } } }
// 技能能否释放默认实现... 每次战斗有X%概率... private bool canCastSkillOpDefault() { //检测释放为奥义伪造的技能,如果是则判定 奥义是否触发过 BT_Logical war = owner._war; BT_MonsterTeam selfTeam = owner.ownerTeam; if (real == 1) { //如果不能释放,则直接跳过。如果可以释放,则再判定概率的问题 bool can = war.canCastAoYi(this, selfTeam); if (can == false) { return(can); } } //再次判定概率的问题 bool probility = false; int possibility = 0; if (opObj.type == SkillOpData.Anger_Skill) { int curTeamAngry = selfTeam.curAngry; int needNuqi = param.nuqi; if (needNuqi == 0) { throw new DragonException("调用canCastSkillOpDefault时,不存在怒气配置. id:" + id); } probility = curTeamAngry >= needNuqi; } else if (opObj.type == SkillOpData.Death_Closed_Skill) { possibility = param.gailv; // 如果有概率的话,则考虑概率触发,否则一定触发 if (possibility > 0) { probility = BT_WarUtils.happen(possibility); } else { // 默认触发 probility = owner._almostDie; } } else { possibility = param.gailv; if (possibility == 0) { throw new DragonException("调用canCastSkillOpDefault时,不存在概率配置. id:" + id); } probility = BT_WarUtils.happen(possibility); } //如果概率Ok,则奥义默认释放 if (probility) { if (real == 1) { //设定奥义 war.setCastAoYi(this, selfTeam); } } return(probility); }