public override void TryProcess()
 {
     base.TryProcess();
     if (this.VerifyAndPopulateData())
     {
         if (FActionStatus.HasFlag(this._data.Char.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.ShieldWalling))
         {
             var util = new VWeaponUtil();
             if (this._data.Char.Proxy.GetLWeapon() != null)
             {
                 var wpn = this._data.Char.Proxy.GetLWeapon();
                 if (wpn.View.ShieldWalling)
                 {
                     util.UndoShieldWallFX(this._data.Char, wpn, true);
                 }
             }
             if (this._data.Char.Proxy.GetRWeapon() != null)
             {
                 var wpn = this._data.Char.Proxy.GetRWeapon();
                 if (wpn.View.ShieldWalling)
                 {
                     util.UndoSpearWallFX(this._data.Char, wpn, false);
                 }
             }
             FActionStatus.SetShieldWallingFalse(this._data.Char.Proxy.GetActionFlags());
         }
     }
 }
Beispiel #2
0
        public void ProcessEnterNewTile(CTile tile)
        {
            AZone spearWallProto = null;

            if (FActionStatus.HasFlag(this._proxy.GetActionFlags().CurFlags, FActionStatus.Flags.Spearwalling))
            {
                spearWallProto = this._proxy.GetZones().Find(x => x.Type == EZone.Spear_Wall_Zone);
            }
            var deleteZones = new List <AZone>();

            foreach (var zone in this.Proxy.GetZones())
            {
                if (zone.GetData().DependsOnSourceChar&& zone.GetData().Source.Equals(this))
                {
                    deleteZones.Add(zone);
                }
            }
            foreach (var zone in deleteZones)
            {
                zone.RemoveFromParentAndSource();
            }
            foreach (var neighbor in tile.GetAdjacent())
            {
                if (spearWallProto != null)
                {
                    this.ProcessSpearwallZone(neighbor, spearWallProto);
                }
                this.ProcessAttackOfOpportunityZone(neighbor);
            }
            this.SetTile(tile);
        }
 public override void TryProcess()
 {
     base.TryProcess();
     if (this.VerifyAndPopulateData())
     {
         if (FActionStatus.HasFlag(this._data.Char.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.Spearwalling))
         {
             var util = new VWeaponUtil();
             if (this._data.Char.Proxy.GetLWeapon() != null)
             {
                 var wpn = this._data.Char.Proxy.GetLWeapon();
                 if (wpn.View.SpearWalling)
                 {
                     util.UndoSpearWallFX(this._data.Char, wpn, true);
                 }
             }
             if (this._data.Char.Proxy.GetRWeapon() != null)
             {
                 var wpn = this._data.Char.Proxy.GetRWeapon();
                 if (wpn.View.SpearWalling)
                 {
                     util.UndoSpearWallFX(this._data.Char, wpn, false);
                 }
             }
             var zones = this._data.Char.Proxy.GetZones().FindAll(x => x.Type == EZone.Spear_Wall_Zone);
             foreach (var zone in zones)
             {
                 zone.RemoveFromParentAndSource();
             }
             FActionStatus.SetSpearWallingFalse(this._data.Char.Proxy.GetActionFlags());
         }
     }
 }
Beispiel #4
0
 private void ProcessTakingAction()
 {
     if (this._combatData.InitiativeOrder.Count > 0)
     {
         var tgt = this._combatData.InitiativeOrder[0];
         tgt.Proxy.ProcessNewTurn();
         if (FActionStatus.HasFlag(tgt.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.Casting))
         {
             var pair = this._currentlyCasting.Find(x => x.X.Equals(tgt));
             if (pair.X != null && pair.Y != null)
             {
                 this._currentlyCasting.Remove(pair);
                 pair.Y.DecrementCastingTurnsRemaining();
                 if (pair.Y.GetCastingTurnsRemaining() <= 0)
                 {
                     pair.Y.AddCallback(this.CharCastDone);
                 }
                 pair.Y.TryProcess();
             }
             else
             {
                 throw new System.Exception("Error: Cannot find casting character, but it is required.");
             }
         }
         else
         {
             var data = new EvNewTurnData();
             data.Target = this._combatData.InitiativeOrder[0];
             var acting = new EvNewTurn(data);
             acting.TryProcess();
         }
     }
 }
Beispiel #5
0
        public override Dictionary <EAbility, double> GetAbilityWeights(CChar agent)
        {
            var weights = base.GetAbilityWeights(agent);

            if (weights.ContainsKey(EAbility.Shield_Wall))
            {
                if (FActionStatus.HasFlag(agent.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.ShieldWalling))
                {
                    weights.Remove(EAbility.Riposte);
                }
                else
                {
                    weights[EAbility.Shield_Wall] = SHIELD_WALL_PREFERENCE;
                }
            }

            if (weights.ContainsKey(EAbility.Riposte))
            {
                if (FActionStatus.HasFlag(agent.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.Riposting))
                {
                    weights.Remove(EAbility.Riposte);
                }
                else
                {
                    weights[EAbility.Spear_Wall] = RIPOSTE_PREFERENCE;
                }
            }

            return(weights);
        }
Beispiel #6
0
        private void TryUndoActionStatuses()
        {
            if (FActionStatus.HasFlag(this._data.Target.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.Riposting))
            {
                var data = new EvUndoRiposteData();
                data.Char = this._data.Target;
                var e = new EvUndoRiposte(data);
                e.TryProcess();
            }

            if (FActionStatus.HasFlag(this._data.Target.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.Spearwalling))
            {
                var data = new EvUndoSpearwallData();
                data.Char = this._data.Target;
                var e = new EvUndoSpearwall(data);
                e.TryProcess();
            }

            if (FActionStatus.HasFlag(this._data.Target.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.ShieldWalling))
            {
                var data = new EvUndoShieldWallData();
                data.Char = this._data.Target;
                var e = new EvUndoShieldWall(data);
                e.TryProcess();
            }
        }
Beispiel #7
0
        private void HandleDoneCasting()
        {
            var jolt = this.Data.Source.GameHandle.GetComponent <SIntervalJoltScript>();

            jolt.Done();
            FActionStatus.SetCastingFalse(this.Data.Source.Proxy.GetActionFlags());
        }
Beispiel #8
0
        private void HandleCasting()
        {
            FActionStatus.SetCastingTrue(this.Data.Source.Proxy.GetActionFlags());
            GUIManager.Instance.SetGUILocked(false);
            GUIManager.Instance.SetInteractionLocked(false);
            CombatManager.Instance.SetCurrentAbilityNone();
            var pair = new Pair <CChar, MAction>(this.Data.Source, this);

            CombatManager.Instance.AddCurrentlyCasting(pair);
            this.HandleCastingJolt();
            var e = new EvEndTurn();

            e.TryProcess();
        }
Beispiel #9
0
 private void HandleHitCounters()
 {
     foreach (var hit in this._data.Hits)
     {
         var target = hit.Data.Target.Current;
         if (target != null && target.GetType().Equals(typeof(CChar)))
         {
             var tgt = target as CChar;
             if (FActionStatus.HasFlag(tgt.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.Riposting))
             {
                 if (FHit.HasFlag(hit.Data.Flags.CurFlags, FHit.Flags.Block) ||
                     FHit.HasFlag(hit.Data.Flags.CurFlags, FHit.Flags.Dodge) ||
                     FHit.HasFlag(hit.Data.Flags.CurFlags, FHit.Flags.Parry))
                 {
                     this.HandleHitCounterHelper(hit, tgt);
                 }
             }
         }
     }
 }
Beispiel #10
0
        private void HandleCharacterOccupant(MTile tile)
        {
            var data = new StrayTargetData();

            data.Tile = tile.Controller;
            var occupant = tile.GetCurrentOccupant() as CChar;

            if (occupant.Proxy.Type == ECharType.Humanoid)
            {
                if (FActionStatus.HasFlag(occupant.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.ShieldWalling))
                {
                    data.Chance = BASE_SHIELDWALL_OBSTRUCTION_CHANCE;
                }
                else if (occupant.Proxy.GetLWeapon() != null && occupant.Proxy.GetLWeapon().IsTypeOfShield())
                {
                    data.Chance = BASE_SHIELD_OBSTRUCTION_CHANCE;
                }
                else if (occupant.Proxy.GetRWeapon() != null && occupant.Proxy.GetRWeapon().IsTypeOfShield())
                {
                    data.Chance = BASE_SHIELD_OBSTRUCTION_CHANCE;
                }
                else
                {
                    data.Chance = BASE_OBSTRUCTION_CHANCE;
                }
            }
            else
            {
                data.Chance = BASE_OBSTRUCTION_CHANCE;
            }
            var pair = new Pair <double, double>(tile.GetCol(), tile.GetRow());

            if (this._strayTargets.ContainsKey(pair))
            {
                this._strayTargets[pair].Chance += data.Chance;
            }
            else
            {
                this._strayTargets.Add(pair, data);
            }
        }
Beispiel #11
0
 public override void ProcessEnterZone(TileMoveData moveData)
 {
     this.FirstSpearWallHit = false;
     this.SpearWallHit      = false;
     base.ProcessEnterZone(moveData);
     if (this._spearWallData.Source != null)
     {
         if (moveData.Target.Proxy.LParty != this._spearWallData.Source.Proxy.LParty)
         {
             moveData.Callback(this);
             var data = new ActionData();
             data.Ability      = EAbility.Pierce;
             data.LWeapon      = this._spearWallData.LWeapon;
             data.ParentWeapon = this._spearWallData.ParentWeapon;
             data.Source       = this._spearWallData.Source;
             data.Target       = moveData.Target.Tile;
             data.WpnAbility   = true;
             this._action      = new MAction(data);
             this._action.AddCallback(moveData.ParentEvent.TryDone);
             moveData.ParentEvent.AddChildAction(this._action);
             var staminaCalc = new StaminaCalculator();
             var cost        = staminaCalc.Process(this._action);
             if (FActionStatus.HasFlag(this._action.Data.Source.Proxy.GetActionFlags().CurFlags, FActionStatus.Flags.Spearwalling) &&
                 cost <= this._action.Data.Source.Proxy.GetPoints(ESecondaryStat.Stamina))
             {
                 this._action.TryProcessNoDisplay();
                 foreach (var hit in this._action.Data.Hits)
                 {
                     if (!FHit.HasFlag(hit.Data.Flags.CurFlags, FHit.Flags.Block) &&
                         !FHit.HasFlag(hit.Data.Flags.CurFlags, FHit.Flags.Dodge) &&
                         !FHit.HasFlag(hit.Data.Flags.CurFlags, FHit.Flags.Parry))
                     {
                         this.SpearWallHit = true;
                     }
                 }
                 this.HandleSpeared(null);
             }
         }
     }
 }
Beispiel #12
0
 public override void Process(MHit hit)
 {
     base.ProcessTile(hit);
     FActionStatus.SetSuppressingAreaTrue(hit.Data.Action.Data.Source.Proxy.GetActionFlags());
 }
Beispiel #13
0
 public override void Process(MHit hit)
 {
     base.ProcessHitMelee(hit);
     FActionStatus.SetSpearWallingTrue(hit.Data.Action.Data.Source.Proxy.GetActionFlags());
 }
Beispiel #14
0
 public override void Process(MHit hit)
 {
     FActionStatus.SetShieldWallingTrue(hit.Data.Action.Data.Source.Proxy.GetActionFlags());
 }