/// <summary> /// 刷新时,会更新宝石状况(diamondInCar="")。 /// </summary> public void Refresh(RoleInGame player, Car car, ref List <string> notifyMsg) { //this.Data["mile"].RemoveAll(item => (item - this.CreateTime).TotalMinutes > 120); //this.Data["business"].RemoveAll(item => (item - this.CreateTime).TotalMinutes > 120); //this.Data["volume"].RemoveAll(item => (item - this.CreateTime).TotalMinutes > 120); //this.Data["speed"].RemoveAll(item => (item - this.CreateTime).TotalMinutes > 120); this._costMiles = 0; this._costBusiness = 0; this._costVolume = 0; if (player.playerType == RoleInGame.PlayerType.player) { MileChanged((Player)player, car, ref notifyMsg, "mile"); BusinessChanged((Player)player, car, ref notifyMsg, "business"); VolumeChanged((Player)player, car, ref notifyMsg, "volume"); SpeedChanged((Player)player, car, ref notifyMsg, "speed"); } this.setCostMiles(0, player, car, ref notifyMsg); // this.costMiles = 0; this.setCostBusiness(0, player, car, ref notifyMsg); //this.set //this.costBusiness = 0; this.setCostVolume(0, player, car, ref notifyMsg); //this.costVolume = 0; this.setDiamondInCar("", player, car, ref notifyMsg); // this.diamondInCar = ""; // this.setSubsidize(0, player, car, ref notifyMsg); // this.subsidize = 0; }
public void failedThenDo(Car car, RoleInGame player, Command c, ref List <string> notifyMsg) { if (c.c == "SetCollect") { this.carDoActionFailedThenMustReturn(car, player, ref notifyMsg); } }
public void setControllingObj(RoleInGame player, Car car, Manager_Driver.ConfuseManger.ControlAttackType controlAttackType, string key, ref List <string> notifyMsg) { this._isControllingKey = key; if (!string.IsNullOrEmpty(this._isControllingKey)) { switch (controlAttackType) { case Manager_Driver.ConfuseManger.ControlAttackType.Confuse: { player.confusePrepareMagicChanged(player, ref notifyMsg); }; break; case Manager_Driver.ConfuseManger.ControlAttackType.Lost: { player.lostPrepareMagicChanged(player, ref notifyMsg); }; break; case Manager_Driver.ConfuseManger.ControlAttackType.Ambush: { player.ambushPrepareMagicChanged(player, ref notifyMsg); }; break; } } //throw new NotImplementedException(); }
public bool carAbilitConditionsOk(RoleInGame player, Car car, Command c) { if (c.c == "SetCollect") { if (car.ability.leftVolume > 0) { SetCollect sc = (SetCollect)c; if (Program.dt.GetFpByIndex(that._collectPosition[sc.collectIndex]).FastenPositionID == sc.fastenpositionID) { return(true); } else { return(false); } } else { this.WebNotify(player, "小车已经没有多余手机容量了,已经安排返回!"); return(false); } } else { return(false); } }
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); } } }
private void arriveThenDoCollect(ref RoleInGame role, ref Car car, commandWithTime.placeArriving pa, ref List <string> notifyMsg, out bool needUpdateCollectState) { needUpdateCollectState = false; if (car.targetFpIndex == -1) { throw new Exception("这个地点应该是等待的地点!"); } if (that._collectPosition.ContainsValue(pa.target)) { int taxPostion = pa.target; //拿到钱的单位是分! long collectReWard = getCollectReWardByReward(pa.target);//依据target来判断应该收入多少! if (role.playerType == RoleInGame.PlayerType.player) { that.NPCM.Moleste((Player)role, pa.target, ref notifyMsg); } long sumCollect = collectReWard; //DealWithTheFrequcy(this.CollectReWard); var selfGet = sumCollect; // long sumDebet = 0; car.ability.setCostVolume(car.ability.costVolume + selfGet, role, car, ref notifyMsg); this.setCollectPosition(pa.target); // this.collectPosition = this.GetRandomPosition(true); needUpdateCollectState = true; Console.WriteLine("----Do the collect process----!"); if (role.playerType == RoleInGame.PlayerType.player) { that.GetMusic((Player)role, ref notifyMsg); } if (role.playerType == RoleInGame.PlayerType.player) { that.GetBackground((Player)role, ref notifyMsg); } } else { Console.WriteLine("----Not do the collect process----!"); } //收集完,留在原地。 //var car = this._Players[cmp.key].getCar(cmp.car); // car.ability.costMiles += pa.costMile;// var newCostMile = car.ability.costMiles + pa.costMile; car.ability.setCostMiles(newCostMile, role, car, ref notifyMsg); // AbilityChanged(player, car, ref notifyMsg, "mile"); carParkOnRoad(pa.target, ref car, role, ref notifyMsg); car.setState(role, ref notifyMsg, CarState.waitOnRoad); that._Players[pa.key].returningOjb = pa.returningOjb; if (role.playerType == RoleInGame.PlayerType.player) { that.frequencyM.addFrequencyRecord(); } // NPCAutoControlCollect(role); }
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; }
protected int getFromWhenAction(RoleInGame role, Car car) { switch (car.state) { case CarState.waitAtBaseStation: { return(role.StartFPIndex); }; case CarState.waitOnRoad: { //小车的上一个的目标 if (car.targetFpIndex == -1) { throw new Exception("参数混乱"); } else { return(car.targetFpIndex); } }; default: { throw new Exception($"错误的汽车状态:{car.state.ToString()}"); } } }
internal void setAnimateData(RoleInGame player, ref List <string> notifyMsg, AnimateData2 data) { this.animateData = data; this._changeState++; SetAnimateChanged(player, this, ref notifyMsg); // throw new NotImplementedException(); }
public bool carAbilitConditionsOk(RoleInGame player, Car car, Command c) { if (c.c == "DialogMsg") { if (car.state == Car.CarState.waitAtBaseStation) { return(true); } else { DialogMsg dm = (DialogMsg)c; dm.Msg = $"你的小车还没有回营地!"; that.ResponMsg(dm); return(false); } } else { return(false); } //if (car.state == Car.CarState.waitAtBaseStation) //{ // return //} // throw new NotImplementedException(); }
public void setCostVolume(long costVolumeCostInput, RoleInGame role, Car car, ref List <string> notifyMsg) { this._costVolume = costVolumeCostInput; if (role.playerType == RoleInGame.PlayerType.player) { VolumeChanged((Player)role, car, ref notifyMsg, "volume"); } }
public void setCostBusiness(long costBusinessCostInput, RoleInGame player, Car car, ref List <string> notifyMsg) { this._costBusiness = costBusinessCostInput; if (player.playerType == RoleInGame.PlayerType.player) { BusinessChanged((Player)player, car, ref notifyMsg, "business"); } }
public void setCostMiles(long costMileInput, RoleInGame role, Car car, ref List <string> notifyMsg) { this._costMiles = costMileInput; if (role.playerType == RoleInGame.PlayerType.player) { MileChanged((Player)role, car, ref notifyMsg, "mile"); } }
private void ReturnToSelf(RoleInGame player, Car car, returnning cmp, ref List <string> notifyMsg) { var speed = car.ability.Speed; int startT = 0; var result = new List <int>(); //RoleInGame boss = cmp.returningOjb.Boss; // that.getStartPositon(Program.dt.GetFpByIndex(cmp.target), (boss.positionInStation + 1) % 5, ref startT); var boss = cmp.returningOjb.Boss; // Program.dt.GetAFromBPoint(cmp.returningOjb.returnToSelfAddrPath, Program.dt.GetFpByIndex(cmp.target), speed, ref result, ref startT, player.improvementRecord.speedValue > 0); if (cmp.returningOjb.returnToSelfAddrPath.path.Count > 0) { Program.dt.GetAFromBPoint(cmp.returningOjb.returnToSelfAddrPath.path[0].path, cmp.returningOjb.returnToSelfAddrPath.path[0].position, speed, ref result, ref startT, player.improvementRecord.speedValue > 0); } var self = player; // that.getEndPositon(Program.dt.GetFpByIndex(self.StartFPIndex), self.positionInStation, ref result, ref startT, player.improvementRecord.speedValue > 0); // result.RemoveAll(item => item.t == 0); car.setState(that._Players[cmp.key], ref notifyMsg, CarState.returning); car.targetFpIndex = self.StartFPIndex; Data.PathStartPoint2 startPosition; if (cmp.returningOjb.returnToSelfAddrPath.path.Count == 0) { //that.getStartPositionByFp(out startPosition, cmp.returningOjb.returnToSelfAddrPath.path[0].position); // that.getStartPositionByFp(out startPosition, Program.dt.GetFpByIndex(player.StartFPIndex)); var fp = Program.dt.GetFpByIndex(player.StartFPIndex); double x, y; CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fp.positionLongitudeOnRoad, fp.positionLatitudeOnRoad, out x, out y); startPosition = new Data.PathStartPoint2() { x = Convert.ToInt32(x * 256), y = Convert.ToInt32(y * 256) }; } else { that.getStartPositionByGoPath(out startPosition, cmp.returningOjb.returnToSelfAddrPath.path[0]); } car.setState(player, ref notifyMsg, CarState.returning); car.setAnimateData(player, ref notifyMsg, new AnimateData2(startPosition, result, DateTime.Now, false)); car.setState(player, ref notifyMsg, CarState.returning); this.StartArriavalThread(startT, 0, player, car, cmp.returningOjb.returnToSelfAddrPath, (newStartT) => { this.startNewThread(newStartT, new commandWithTime.comeBack() { c = "comeBack", //car = cmp.car, key = cmp.key }, this); }, player); }
public void setDiamondInCar(string diamondInCarInput, RoleInGame role, Car car, ref List <string> notifyMsg) { bool changed = this._diamondInCar != diamondInCarInput; this._diamondInCar = diamondInCarInput; if (role.playerType == RoleInGame.PlayerType.player && changed) { this.DiamondInCarChanged((Player)role, car, ref notifyMsg, this.diamondInCar); } }
public void RefreshAfterDriverArrived(RoleInGame player, Car car, ref List <string> notifyMsg) { if (player.playerType == RoleInGame.PlayerType.player) { MileChanged((Player)player, car, ref notifyMsg, "mile"); BusinessChanged((Player)player, car, ref notifyMsg, "business"); VolumeChanged((Player)player, car, ref notifyMsg, "volume"); SpeedChanged((Player)player, car, ref notifyMsg, "speed"); } }
public void failedThenDo(Car car, RoleInGame player, Command c, ref List <string> notifyMsg) { if (c.c == "SetPromote") { // SetAttack sa = (SetAttack)c; this.carDoActionFailedThenMustReturn(car, player, ref notifyMsg); //this.carsAttackFailedThenMustReturn(car, player, sa, ref notifyMsg); } //throw new NotImplementedException(); }
private void ReturnThenSetComeBack(RoleInGame player, Car car, commandWithTime.returnning cmp, ref List <string> notifyMsg) { if (cmp.returningOjb.NeedToReturnBoss) { ReturnToBoss(player, car, cmp, ref notifyMsg); } else { ReturnToSelf(player, car, cmp, ref notifyMsg); } }
public bool carAbilitConditionsOk(RoleInGame player, Car car, Command c) { if (car.ability.diamondInCar == "") { return(car.state == CarState.waitAtBaseStation || car.state == CarState.waitOnRoad); } else { return(false); } }
public long ImproveAttack(RoleInGame role, long attackMoney) { if (role.improvementRecord.attackValue > 0) { var larger = Program.rm.magicE.enlarge(attackMoney); return(larger); } else { return(attackMoney); } }
public commandWithTime.ReturningOjb maindDo(RoleInGame player, Car car, Command c, ref List <string> notifyMsg, out MileResultReason mrr) { if (c.c == "SetCollect") { var sc = (SetCollect)c; return(this.collect(player, car, sc, ref notifyMsg, out mrr)); } else { throw new Exception($"数据传输错误!(传出类型为{c.c})"); } }
public RoomMainF.RoomMain.commandWithTime.ReturningOjb maindDo(RoleInGame player, Car car, Command c, ref List <string> notifyMsg, out MileResultReason mrr) { if (c.c == "SetAttack") { var sa = (SetAttack)c; return(attack(player, car, sa, ref notifyMsg, out mrr)); } else { throw new Exception($"数据传输错误!(传出类型为{c.c})"); } }
public commandWithTime.ReturningOjb collectPassBossAddress(RoleInGame player, RoleInGame boss, Car car, SetCollect sc, ref List <string> notifyMsg, out MileResultReason mrr) { if (car.ability.leftVolume > 0) { var from = this.GetFromWhenUpdateCollect(that._Players[sc.Key], sc.cType, car); var to = getCollectPositionTo(sc.collectIndex); // this.promoteMilePosition; // return ActionInBoss(from, to); var fp1 = Program.dt.GetFpByIndex(from); var fp2 = Program.dt.GetFpByIndex(to); var fbBase = Program.dt.GetFpByIndex(player.StartFPIndex); //var goPath = Program.dt.GetAFromB(fp1, fp2.FastenPositionID); //var goPath = Program.dt.GetAFromB(from, to); var goPath = that.GetAFromB_v2(from, to, player, ref notifyMsg); var returnToBossPath = that.GetAFromB_v2(to, boss.StartFPIndex, player, ref notifyMsg); var returnToSelfPath = that.GetAFromB_v2(boss.StartFPIndex, player.StartFPIndex, player, ref notifyMsg); var goMile = that.GetMile(goPath); var returnToBossMile = that.GetMile(returnToBossPath); var returnToSelfMile = that.GetMile(returnToSelfPath); if (car.ability.leftMile >= goMile + returnToBossMile + returnToSelfMile) { int startT; this.EditCarStateWhenActionStartOK(player, ref car, to, fp1, goPath, ref notifyMsg, out startT); var ro = commandWithTime.ReturningOjb.ojbWithBoss(returnToBossPath, returnToSelfPath, boss); car.setState(player, ref notifyMsg, CarState.working); StartArriavalThread(startT, 0, player, car, sc, ro, goMile, goPath); // getAllCarInfomations(sc.Key, ref notifyMsg); mrr = MileResultReason.Abundant;//返回原因 return(ro); } else if (car.ability.leftMile >= goMile) { // printState(player, car, $"剩余里程为{car.ability.leftMile}去程{goMile},回程{returnMile},你去了回不来。所以安排返回"); mrr = MileResultReason.CanNotReturn; return(player.returningOjb); } else { // printState(player, car, $"剩余里程为{car.ability.leftMile}去程{goMile},回程{returnMile},去不了。所以安排返回"); mrr = MileResultReason.CanNotReach; return(player.returningOjb); // return false; } } else { mrr = MileResultReason.MoneyIsNotEnougt; this.WebNotify(player, "你身上的剩余收集空间不够啦!"); return(player.returningOjb); } }
public commandWithTime.ReturningOjb maindDo(RoleInGame player, Car car, Command c, ref List <string> notifyMsg, out MileResultReason mrr) { // throw new NotImplementedException(); if (c.c == "SetPromote") { var sp = (SetPromote)c; return(this.promote(player, car, sp, ref notifyMsg, out mrr)); } else { throw new Exception($"数据传输错误!(传出类型为{c.c})"); } }
internal void SetReturnFromBoss(int v, RoleInGame boss, returnning returnning) { this.startNewThread(v, returnning, this); //this.newt //returnning returnningObj = new returnning() //{ // c = "returnning", // changeType = returnning.ChangeType.AfterTax, // key = returnning.key, // returningOjb = returnning.returningOjb //}; //this.newThreadDo(returnningObj); //throw new NotImplementedException(); }
/// <summary> /// 获取出发地点 /// </summary> /// <param name="player"></param> /// <param name="cType"></param> /// <param name="car"></param> /// <returns></returns> private int GetFromWhenUpdateCollect(RoleInGame player, string cType, Car car) { switch (cType) { case "findWork": { switch (car.state) { case CarState.waitAtBaseStation: { if (car.targetFpIndex != -1) { //出现这种情况,应该是回了基站里没有初始 throw new Exception("参数混乱"); } else { return(player.StartFPIndex); } }; case CarState.working: { //出现这种情况,应该是回了基站里没有初始 throw new Exception("参数混乱"); }; case CarState.waitOnRoad: { if (car.targetFpIndex == -1) { throw new Exception("参数混乱"); } else { return(car.targetFpIndex); } }; case CarState.returning: { throw new Exception("参数混乱"); }; } ; }; break; } throw new Exception("非法调用"); }
/// <summary> /// 这个方法没有targetPlayer,所以不进入station /// </summary> /// <param name="indexValue"></param> /// <param name="player"></param> /// <param name="car"></param> /// <param name="goPath"></param> /// <param name="notifyMsg"></param> /// <param name="startT"></param> public void EditCarStateAfterSelect(int indexValue, RoleInGame player, ref Car car, Node goPath, ref List <string> notifyMsg, out int startT) { var speed = car.ability.Speed; startT = 0; List <int> result; Data.PathStartPoint2 startPosition; { result = new List <int>(); that.getStartPositionByGoPath(out startPosition, goPath.path[indexValue]); } Program.dt.GetAFromBPoint(goPath.path[indexValue].path, goPath.path[indexValue].path[0], speed, ref result, ref startT, player.improvementRecord.speedValue > 0); car.setAnimateData(player, ref notifyMsg, new AnimateData2(startPosition, result, DateTime.Now, false)); }
internal commandWithTime.ReturningOjb randomWhenConfused(RoleInGame player, RoleInGame boss, Car car, SetAttack sa, ref List <string> notifyMsg, out MileResultReason Mrr) { AttackObj ao = new AttackObj(sa, (int startT, Car car, SetAttack sa, int goMile, Node goPath, commandWithTime.ReturningOjb ro) => { //this.SetAttackArrivalThread() List <string> notifyMsg = new List <string>(); car.setState(player, ref notifyMsg, CarState.working); this.sendMsg(notifyMsg); this.SetAttackArrivalThread(startT, 0, player, car, sa, goMile, goPath, ro); } ); return(this.randomWhenConfused(player, boss, car, ao, ref notifyMsg, out Mrr)); }
//public long getVolumeOrBussiness(Manager_Driver.ConfuseManger.AmbushInfomation ambushInfomation) //{ // return 0; // // return ambushInfomation.bussinessValue; //} public long ImproveAttack(RoleInGame role, long attackMoney, ref List <string> notifyMsgs) { if (role.improvementRecord.attackValue > 0) { var larger = Program.rm.magicE.enlarge(attackMoney); if (larger - attackMoney > 0) { role.improvementRecord.reduceAttack(role, larger, ref notifyMsgs); } return(larger); } else { return(attackMoney); } //throw new NotImplementedException(); }
public void AbilityAdd(string pType, RoleInGame role, Car car, ref List <string> notifyMsg) { if (this.Data.ContainsKey(pType)) { this.Data[pType].Add(DateTime.Now); switch (pType) { case "mile": { if (role.playerType == RoleInGame.PlayerType.player) { var player = (Player)role; this.MileChanged(player, car, ref notifyMsg, pType); } }; break; case "business": { if (role.playerType == RoleInGame.PlayerType.player) { var player = (Player)role; this.BusinessChanged(player, car, ref notifyMsg, pType); } }; break; case "volume": { if (role.playerType == RoleInGame.PlayerType.player) { var player = (Player)role; this.VolumeChanged(player, car, ref notifyMsg, pType); } }; break; case "speed": { if (role.playerType == RoleInGame.PlayerType.player) { var player = (Player)role; this.SpeedChanged(player, car, ref notifyMsg, pType); } }; break; } } }