public void setState(RoleInGame player, ref List <string> notifyMsg, CarState s) { this._state = s; if (player.playerType == RoleInGame.PlayerType.player) { SendStateAndPurpose((Player)player, this, ref notifyMsg); } if (s == CarState.waitOnRoad) { if (player.playerType == RoleInGame.PlayerType.NPC) { ((NPC)player).dealWithWaitedNPC(ref notifyMsg); } } if (this._state != CarState.waitOnRoad) { if (string.IsNullOrEmpty(player.getCar().isControllingKey)) { } else { player.getCar().clearControllingObj(); player.controlPrepareMagicChanged(player, ref notifyMsg); } } }
internal void DealWithReduceWhenAttack(interfaceOfHM.AttackT at, RoleInGame player, Car car, RoleInGame victim, long percentValue, ref List <string> notifyMsg, out long reduce, long m, ref long reduceSum) { var attackMoneyBeforeDefend = (at.leftValue(car.ability) * (100 - at.GetDefensiveValue(victim.getCar().ability.driver)) / 100) * percentValue / 100; var attackMoneyAfterDefend = (at.leftValue(car.ability) * (100 - at.GetDefensiveValue(victim.getCar().ability.driver, victim.improvementRecord.defenceValue > 0)) / 100) * percentValue / 100; attackMoneyBeforeDefend = Math.Max(1, attackMoneyBeforeDefend); attackMoneyAfterDefend = Math.Max(1, attackMoneyAfterDefend); long attackMoney; if (attackMoneyBeforeDefend == attackMoneyAfterDefend) { attackMoney = attackMoneyBeforeDefend; } else { attackMoney = attackMoneyAfterDefend; victim.improvementRecord.reduceDefend(victim, attackMoneyBeforeDefend, ref notifyMsg); } attackMoney = at.ImproveAttack(player, attackMoney, ref notifyMsg); reduce = attackMoney; if (reduce > m) { reduce = m; } reduce = Math.Max(1, reduce); at.setCost(reduce, player, car, ref notifyMsg); //this.WebNotify(victim, $"【{player.PlayerName}】对你进行了{at.GetSkillName()},损失{(reduce / 100.00).ToString("f2")}金币 "); this.WebNotify(player, $"你对【{victim.PlayerName}】进行了{at.GetSkillName()},获得{(reduce / 100.00).ToString("f2")}金币。其还有{(victim.Money / 100.00).ToString("f2")}金币。"); this.WebNotify(victim, $"【{player.PlayerName}】对你进行了{at.GetSkillName()},损失{(reduce / 100.00).ToString("f2")}金币 "); reduceSum += reduce; }
internal long DealWithReduceWhenSimulationWithoutDefendMagic(interfaceOfHM.AttackT at, RoleInGame player, Car car, RoleInGame victim, long percentValue) { var attackMoneyBeforeDefend = (at.leftValue(car.ability) * (100 - at.GetDefensiveValue(victim.getCar().ability.driver)) / 100) * percentValue / 100; return(attackMoneyBeforeDefend); }