public static int MoveHurt(this PokemonProxy pm, int damage, bool ability) { if (damage >= pm.Hp) { damage = pm.Hp; if (STs.Remaining1HP(pm, ability)) { damage--; pm.Pokemon.SetHp(1); } else { pm.Pokemon.SetHp(0); } } else { pm.Pokemon.SetHp(pm.Hp - damage); } if (damage != 0) { pm.OnboardPokemon.SetTurnCondition(Cs.Assurance); } return(damage); }
private static void ChangeLv7DImplement(this PokemonProxy pm, PokemonProxy by, StatType stat, int actualChange, string log) { if (actualChange != 0) { if (stat == StatType.Accuracy) { pm.OnboardPokemon.AccuracyLv += actualChange; } else if (stat == StatType.Evasion) { pm.OnboardPokemon.EvasionLv += actualChange; } else { pm.OnboardPokemon.ChangeLv7D(stat, actualChange); } if (log == null) { switch (actualChange) { case 1: log = "7DUp1"; break; case 2: log = "7DUp2"; break; case -1: log = "7DDown1"; break; case -2: log = "7DDown2"; break; default: if (actualChange > 0) { log = "7DUp3"; } else { log = "7DDown3"; } break; } } ShowLogPm(pm, log, (int)stat); if ((by == null || by.Pokemon.TeamId != pm.Pokemon.TeamId) && actualChange < 0) { STs.Lv7DDown(pm); } } }
private PokemonProxy SendOutImplement(Tile tile) { var origin = tile.WillSendOutPokemonIndex; var pm = Controller.GetPlayer(tile).GetPokemon(origin); pm.Action = PokemonAction.Debuting; tile.Pokemon = pm; tile.WillSendOutPokemonIndex = Tile.NOPM_INDEX; pm.OnboardPokemon = new OnboardPokemon(pm.Pokemon, tile.X); STs.SendingOut(pm); Controller.ActingPokemons.Insert(0, pm); ReportBuilder.SendOut(pm, origin); return pm; }
internal void Switch() { if (Action == PokemonAction.WillSwitch) { STs.WillAct(this); Action = PokemonAction.Switching; Tile tile = Tile; if (Controller.Withdraw(this, "Withdraw", 0, true)) { Controller.SendOut(tile); } Action = PokemonAction.InBall; } }
public ECINFOS() { InitializeComponent(); CTYPEs.Add("数值", "数值"); CTYPEs.Add("文本", "文本"); STs.Add("未使用", 1); STs.Add("使用中", 2); STs.Add("停用", 3); BTYPE.Add("通用", "通用"); BTYPE.Add("产品", "产品"); ISINTERVALs.Add("是", true); ISINTERVALs.Add("否", false); }
public bool Withdraw(PokemonProxy pm, string log, int arg1, bool canPursuit) { if (CanWithdraw(pm)) { if (log != null) pm.ShowLogPm(log, arg1); STs.Withdrawing(pm, canPursuit); if (pm.Tile != null) { ReportBuilder.Withdraw(pm); var ability = pm.Ability; pm.Action = PokemonAction.InBall; pm.Tile.Pokemon = null; pm.OnboardPokemon = pm.NullOnboardPokemon; Controller.ActingPokemons.Remove(pm); ATs.Withdrawn(pm, ability); return true; } } return false; }
public void StartExecute(MoveTypeE move, Tile selectTile = null, string log = "UseMove") { Move = move; if (STs.CanExecuteMove(Attacker, Move)) { if (log != null) { Attacker.ShowLogPm(log, Move.Id); } InitAtkContext.Execute(this); MoveE.BuildDefContext(this, selectTile); //蓄力技如果选择的是压力特性的精灵,在第一回合就会扣取2点PP,即使最后攻击到的不是压力特性的精灵。 if (MoveProxy != null) { ATs.Pressure(this, Move.GetRange(Attacker)); } MoveExecute.Execute(this); } else { FailAll(null); } }
public void StartExecute(MoveTypeE move, Tile selectTile = null, string log = "UseMove", bool canChangeZmove = true) { Move = move; if (Attacker.SelectZmove && canChangeZmove && !move.Zmove && move.Move.Category != MoveCategory.Status) { Move = MoveTypeE.Get(GameHelper.CommonZmove(Move.Move)); trans = true; transmove = move; } else { trans = false; } if (STs.CanExecuteMove(Attacker, Move)) { InitAtkContext.Execute(this); MoveE.BuildDefContext(this, selectTile); //蓄力技如果选择的是压力特性的精灵,在第一回合就会扣取2点PP,即使最后攻击到的不是压力特性的精灵。 if (MoveProxy != null) { ATs.Pressure(this, Move.GetRange(Attacker)); } if (log == "FSDD") { Target.Defender.ShowLogPm(log, Move.Id); } else if (log != null) { Attacker.ShowLogPm(log, Move.Id); } MoveExecute.Execute(this, selectTile); } else { FailAll(null); } }
internal void Move() { if (SelectZmove) { Pokemon.Zmove = true; } STs.FocusPunch(Controller); LastMoveTurn = Controller.TurnNumber; STs.WillAct(this); switch (Action) { case PokemonAction.Stiff: PTs.ShowLogPm(this, "Stiff"); Action = PokemonAction.Done; break; case PokemonAction.Moving: if (AtkContext.Move.Id == Ms.SKY_DROP) { CoordY = CoordY.Plate; if (AtkContext.Target.Defender.AliveOnboard) { AtkContext.Target.Defender.CoordY = CoordY.Plate; AtkContext.Target.Defender.OnboardPokemon.RemoveCondition(Cs.SkyDrop); } else { AtkContext.SetTargets(Enumerable.Empty <DefContext>()); } } if (CanExecute()) { if (AtkContext.Move.Id != Ms.BIDE) { PTs.ShowLogPm(this, "UseMove", AtkContext.Move.Id); } AtkContext.ContinueExecute(SelectedTarget); } else { Action = PokemonAction.Done; } break; case PokemonAction.MoveAttached: { var o = OnboardPokemon.GetCondition(Cs.Encore); if (o != null) { foreach (var m in Moves) { if (m.MoveE == o.Move) { SelectedMove = m; } } } } ATs.StanceChange(this); if (SelectZmove && SelectedMove.MoveE.Move.Category == MoveCategory.Status) { switch (GameHelper.ZStatus(SelectedMove.MoveE.Move.Id)) { case 0: break; case 1: this.ChangeLv7D(this, StatType.Atk, 1, false); break; case 2: this.ChangeLv7D(this, StatType.Atk, 2, false); break; case 3: this.ChangeLv7D(this, StatType.Atk, 3, false); break; case 4: this.ChangeLv7D(this, StatType.Def, 1, false); break; case 5: this.ChangeLv7D(this, StatType.SpAtk, 1, false); break; case 6: this.ChangeLv7D(this, StatType.SpAtk, 2, false); break; case 7: this.ChangeLv7D(this, StatType.SpDef, 1, false); break; case 8: this.ChangeLv7D(this, StatType.SpDef, 2, false); break; case 9: this.ChangeLv7D(this, StatType.Speed, 1, false); break; case 10: this.ChangeLv7D(this, StatType.Speed, 2, false); break; case 11: this.ChangeLv7D(this, StatType.Accuracy, 1, false); break; case 12: this.ChangeLv7D(this, StatType.Evasion, 1, false); break; case 13: this.ChangeLv7D(this, false, false, 1, 1, 1, 1, 1, 0, 0); break; case 14: if (OnboardPokemon.AddCondition(Cs.FocusEnergy)) { this.ShowLogPm("En" + Cs.FocusEnergy); } break; case 15: ITs.Reset7D(this); break; case 16: this.HpRecover(Pokemon.MaxHp); break; case 17: if (Pokemon.Owner.PmsAlive > Controller.GameSettings.Mode.OnboardPokemonsPerPlayer()) { Tile.SetTurnCondition(Cs.Zheal); } break; case 18: OnboardPokemon.AddTurnCondition(Cs.FollowMe, SelectedMove.MoveE.Move.Id); this.ShowLogPm(Ls.EnFollowMe); break; default: break; } if (SelectedMove.MoveE.Move.Id == Ms.CURSE) { if (OnboardPokemon.HasType(BattleType.Ghost)) { this.HpRecover(Pokemon.MaxHp); } else { this.ChangeLv7D(this, StatType.Atk, 1, false); } } } if (CanExecute() && SelectedMove.CanExecute()) { _atkContext = null; SelectedMove.Execute(); var o = OnboardPokemon.GetCondition(Cs.LastMove); if (o == null) { o = new Condition(); o.Move = AtkContext.Move; OnboardPokemon.SetCondition(Cs.LastMove, o); } else if (o.Move != AtkContext.Move) { o.Move = AtkContext.Move; o.Int = 0; } if (AtkContext.Fail) { o.Int = 0; } else { o.Int++; } Controller.Board.SetCondition(Cs.LastMove, o); } else { OnboardPokemon.RemoveCondition(Cs.LastMove); Action = PokemonAction.Done; } if (AtkContext != null && AtkContext.Move.Dance && AtkContext.Attacker.LastMoveTurn == Controller.TurnNumber) { foreach (var p in Controller.Board.Pokemons) { if (p != null && p.AbilityE(As.Dancer) && p != AtkContext.Attacker) { p.RaiseAbility(); AtkContext dance = new AtkContext(p); dance.StartExecute(AtkContext.Move, null, "UseMove", false); } } } break; } //switch(Action) }
internal void Move() { STs.FocusPunch(Controller); LastMoveTurn = Controller.TurnNumber; STs.WillAct(this); switch (Action) { case PokemonAction.Stiff: PTs.ShowLogPm(this, "Stiff"); Action = PokemonAction.Done; break; case PokemonAction.Moving: if (AtkContext.Move.Id == Ms.SKY_DROP) { CoordY = CoordY.Plate; if (AtkContext.Target.Defender.AliveOnboard) { AtkContext.Target.Defender.CoordY = CoordY.Plate; AtkContext.Target.Defender.OnboardPokemon.RemoveCondition(Cs.SkyDrop); } else { AtkContext.SetTargets(Enumerable.Empty <DefContext>()); } } if (CanExecute()) { if (AtkContext.Move.Id != Ms.BIDE) { PTs.ShowLogPm(this, "UseMove", AtkContext.Move.Id); } AtkContext.ContinueExecute(SelectedTarget); } else { Action = PokemonAction.Done; } break; case PokemonAction.MoveAttached: { var o = OnboardPokemon.GetCondition(Cs.Encore); if (o != null) { foreach (var m in Moves) { if (m.MoveE == o.Move) { SelectedMove = m; } } } } ATs.StanceChange(this); if (CanExecute() && SelectedMove.CanExecute()) { _atkContext = null; SelectedMove.Execute(); var o = OnboardPokemon.GetCondition(Cs.LastMove); if (o == null) { o = new Condition(); o.Move = AtkContext.Move; OnboardPokemon.SetCondition(Cs.LastMove, o); } else if (o.Move != AtkContext.Move) { o.Move = AtkContext.Move; o.Int = 0; } if (AtkContext.Fail) { o.Int = 0; } else { o.Int++; } Controller.Board.SetCondition(Cs.LastMove, o); } else { OnboardPokemon.RemoveCondition(Cs.LastMove); Action = PokemonAction.Done; } break; } //switch(Action) }
public static void FilterDefContext(AtkContext atk) { if ((atk.Move.Id == Ms.FUTURE_SIGHT || atk.Move.Id == Ms.DOOM_DESIRE) && !atk.HasCondition(Cs.FSDD)) { return; } if (atk.Targets == null) { return; } var move = atk.Move; var aer = atk.Attacker; if (move.GetRange(aer) == MoveRange.SelectedTarget) { var all = atk.Move.IsRemote || aer.Controller.GameSettings.Mode != GameMode.Triple; PokemonProxy retarget = null; var rp = !(aer.OnboardPokemon.HasType(BattleType.Grass) || aer.AbilityE(As.OVERCOAT) || aer.ItemE(Is.SAFETY_GOGGLES)); foreach (var pm in atk.Controller.OnboardPokemons) { if (pm.Pokemon.TeamId != aer.Pokemon.TeamId && pm != atk.Target.Defender && (all || aer.OnboardPokemon.X == 1 || aer.OnboardPokemon.X != pm.OnboardPokemon.X)) { var fm = pm.OnboardPokemon.GetCondition <int>(Cs.FollowMe); if (fm != 0 && (rp || fm != Ms.RAGE_POWDER)) { retarget = pm; break; } } } if (retarget == null) { int ab = 0; if (atk.Type == BattleType.Electric) { ab = As.LIGHTNINGROD; } else if (atk.Type == BattleType.Water) { ab = As.STORM_DRAIN; } if (ab != 0) { foreach (var pm in atk.Controller.Board.Pokemons) { if (pm != aer && pm != atk.Target.Defender && (all || aer.OnboardPokemon.X == 1 || pm.OnboardPokemon.X == 1 || aer.Pokemon.TeamId != pm.Pokemon.TeamId && aer.OnboardPokemon.X != pm.OnboardPokemon.X) && pm.RaiseAbility(ab)) { retarget = pm; break; } } } } if (retarget != null) { retarget.ShowLogPm("ReTarget"); atk.SetTargets(new DefContext[] { new DefContext(atk, retarget) }); } } List <DefContext> targets = atk.Targets.ToList(); #region Check CoordY { var count = 0; foreach (DefContext def in targets.ToArray()) { ++count; if (!(def.Defender.CoordY == CoordY.Plate || def.NoGuard || IsYInRange(def))) { def.Defender.ShowLogPm(Ls.Miss); targets.Remove(def); } } if (count > 1) { atk.MultiTargets = true; } } #endregion #region Attack Move and Thunder Wave: Check for Immunity (or Levitate) on the Ally side, position 1, then position 3. Then check Opponent side, position 1, then 2, then 3, foreach (DefContext def in targets.ToArray()) { if (!HasEffect.Execute(def)) { targets.Remove(def); def.Defender.NoEffect(); } } #endregion #region WideGuard QuickGuard CraftyShield MatBlock if (move.Move.Category != MoveCategory.Status && move.Move.Range != MoveRange.SelectedTarget) { foreach (var def in targets.ToArray()) { if (def.Defender.Field.HasCondition(Cs.WideGuard)) { def.Defender.ShowLogPm("WideGuard"); targets.Remove(def); } } } if (aer.Priority > 0 && move.Id != Ms.FEINT) { foreach (var def in targets.ToArray()) { if (def.Defender.Field.HasCondition(Cs.QuickGuard)) { def.Defender.ShowLogPm("QuickGuard"); targets.Remove(def); } } } if (move.Move.Category == MoveCategory.Status) { foreach (var def in targets.ToArray()) { if (def.Defender.Field.HasCondition(Cs.CraftyShield)) { def.Defender.ShowLogPm("CraftyShield"); targets.Remove(def); } } } else { var d0 = targets.FirstOrDefault(); if (d0 != null && d0.Defender.Field.HasCondition(Cs.MatBlock)) { d0.Defender.Controller.ReportBuilder.ShowLog("MatBlock", move.Id); var td = d0.Defender.Pokemon.TeamId; foreach (var d in targets.ToArray()) { if (d.Defender.Pokemon.TeamId == td) { targets.Remove(d); } } d0 = targets.FirstOrDefault(); if (d0 != null && d0.Defender.Field.HasCondition(Cs.MatBlock)) { targets.Clear(); } } } #endregion #region Protect KingsShield SpikyShield if (move.Protectable) { foreach (DefContext d in targets.ToArray()) { if (d.Defender.OnboardPokemon.HasCondition(Cs.Protect)) { d.Defender.ShowLogPm("Protect"); targets.Remove(d); } } } if (move.Move.Category != MoveCategory.Status) { foreach (var d in targets.ToArray()) { if (d.Defender.OnboardPokemon.HasCondition(Cs.SpikyShield)) { d.Defender.ShowLogPm("Protect"); if (move.NeedTouch) { aer.EffectHurtByOneNth(8); } targets.Remove(d); } } foreach (var d in targets.ToArray()) { if (d.Defender.OnboardPokemon.HasCondition(Cs.KingsShield)) { d.Defender.ShowLogPm("Protect"); if (move.NeedTouch) { aer.ChangeLv7D(d.Defender, StatType.Atk, -2, false); } targets.Remove(d); } } } #endregion #region Check for Telepathy (and possibly other abilities) { var mc = move.MagicCoat && !atk.HasCondition(Cs.IgnoreMagicCoat); var ab = atk.DefenderAbilityAvailable(); foreach (DefContext def in targets.ToArray()) { if (def.Defender != atk.Attacker && (mc && STs.MagicCoat(atk, def.Defender) || ab && !CanImplement.Execute(def))) { targets.Remove(def); } } } #endregion if (move.Move.Category == MoveCategory.Status && !atk.IgnoreSubstitute()) { foreach (DefContext d in targets.ToArray()) { if (d.Defender != aer && d.Defender.OnboardPokemon.HasCondition(Cs.Substitute)) { d.Fail(); targets.Remove(d); } } } if (move.Id == Ms.SKY_DROP) { foreach (var d in targets.ToArray()) { if (d.Defender.OnboardPokemon.Weight >= 200) { d.Fail(); targets.Remove(d); } } } #region Check for misses if (!MustHit(atk)) { if (move.Class != MoveClass.OHKO) { atk.AccuracyModifier = STs.AccuracyModifier(atk); } foreach (DefContext def in targets.ToArray()) { if (!(MustHit(def) || CanHit(def))) { targets.Remove(def); def.Defender.ShowLogPm(Ls.Miss); } } } #endregion atk.SetTargets(targets); }
public async Task <List <SearchedPosition> > Handle(SearchPositionQuery request, CancellationToken cancellationToken) { List <SearchedPosition> result = new List <SearchedPosition>(); List <SearchedOrgPosition> OrgPositions = await _mediator.Send(new SearchOrgPositionQuery() { }).ConfigureAwait(false); if (request.Id != null) { result = await(from p in _context.Position join w in _context.WorkArea on p.WorkingAreaId equals w.Id into pw from rpw in pw.DefaultIfEmpty() join OP in OrgPositions on p.PositionTypeId equals OP.Id into OPs from rops in OPs.DefaultIfEmpty() join ST in _context.SalaryType on p.SalaryTypeId equals ST.Id into STs from str in STs.DefaultIfEmpty() join L in _context.Location on p.LocationId equals L.Id into Ls from Lr in Ls.DefaultIfEmpty() join PT in _context.PlanType on p.PlanTypeId equals PT.Id into PTs from PTr in PTs.DefaultIfEmpty() where p.Id == request.Id select new SearchedPosition { Id = p.Id, ParentId = p.ParentId, NodeId = Convert.ToInt32(p.Id), ParentNodeId = Convert.ToInt32(p.ParentId), WorkingAreaId = p.WorkingAreaId, Code = p.Code, PositionTypeId = p.PositionTypeId, LocationId = p.LocationId, SalaryTypeId = p.SalaryTypeId, Sorter = p.Sorter, OrganoGramId = p.OrganoGramId, PlanTypeId = p.PlanTypeId, WorkAreaText = rpw.Title, RankText = rops.RankText, PositionTypeText = rops.PositionTypeText, OrgUnitText = rops.OrgUnitText, SalaryTypeText = str.Dari, LocationText = Lr.Dari, PlanTypeText = PTr.Name, }).OrderBy(c => c.Sorter).DefaultIfEmpty().ToListAsync(cancellationToken); } //if (request.ParentId != null) //{ // result = await (from p in _context.Position // join w in _context.WorkArea on p.WorkingAreaId equals w.Id into pw // from rpw in pw.DefaultIfEmpty() // join OP in OrgPositions on p.PositionTypeId equals OP.Id into OPs // from rops in OPs.DefaultIfEmpty() // join ST in _context.SalaryType on p.SalaryTypeId equals ST.Id into STs // from str in STs.DefaultIfEmpty() // join L in _context.Location on p.LocationId equals L.Id into Ls // from Lr in Ls.DefaultIfEmpty() // join PT in _context.PlanType on p.PlanTypeId equals PT.Id into PTs // from PTr in PTs.DefaultIfEmpty() // where p.ParentId == request.ParentId // select new SearchedPosition // { // Id = p.Id, // ParentId = p.ParentId, // NodeId = Convert.ToInt32(p.Id), // ParentNodeId = Convert.ToInt32(p.ParentId), // WorkingAreaId = p.WorkingAreaId, // Code = p.Code, // PositionTypeId = p.PositionTypeId, // LocationId = p.LocationId, // SalaryTypeId = p.SalaryTypeId, // Sorter = p.Sorter, // OrganoGramId = p.OrganoGramId, // PlanTypeId = p.PlanTypeId, // WorkAreaText = rpw.Title, // RankText = rops.RankText, // PositionTypeText = rops.PositionTypeText, // OrgUnitText = rops.OrgUnitText, // SalaryTypeText = str.Dari, // LocationText = Lr.Dari, // PlanTypeText = PTr.Name, // }).OrderBy(c => c.Sorter).DefaultIfEmpty().ToListAsync(cancellationToken); //} else if (request.OrganoGramId != null) { result = await(from position in _context.Position join w in _context.WorkArea on position.WorkingAreaId equals w.Id into pw from rpw in pw.DefaultIfEmpty() join OP in OrgPositions on position.PositionTypeId equals OP.Id into OPs from rops in OPs.DefaultIfEmpty() join ST in _context.SalaryType on position.SalaryTypeId equals ST.Id into STs from str in STs.DefaultIfEmpty() join L in _context.Location on position.LocationId equals L.Id into Ls from Lr in Ls.DefaultIfEmpty() join PT in _context.PlanType on position.PlanTypeId equals PT.Id into PTs from PTr in PTs.DefaultIfEmpty() where position.OrganoGramId == request.OrganoGramId select new SearchedPosition { Id = position.Id, ParentId = position.ParentId, NodeId = Convert.ToInt32(position.Id), ParentNodeId = Convert.ToInt32(position.ParentId), WorkingAreaId = position.WorkingAreaId, Code = position.Code, PositionTypeId = position.PositionTypeId, LocationId = position.LocationId, SalaryTypeId = position.SalaryTypeId, Sorter = position.Sorter, OrganoGramId = position.OrganoGramId, PlanTypeId = position.PlanTypeId, WorkAreaText = rpw.Title, RankText = rops.RankText, PositionTypeText = rops.PositionTypeText, OrgUnitText = rops.OrgUnitText, SalaryTypeText = str.Dari, LocationText = Lr.Dari, PlanTypeText = PTr.Name, }).OrderBy(c => c.Sorter).ToListAsync(cancellationToken); } return(result); }