コード例 #1
0
        public BattleEffect ActionEffect; //+ effect priority
        //dictionary effect trigger+speed to effect script
        public CreatureAction(string Name, CreatureElement Element, ActionCategory Catagory, byte Speed, short Priority, byte Power, byte Usage, byte Mana, BattleEffect ActionEffect)
        {
            this.Name         = Name;
            this.Element      = Element;
            this.Catagory     = Catagory;
            this.Speed        = Speed;
            this.Priority     = (byte)(4 + Priority);
            this.Power        = Power;
            this.Usage        = Usage;
            this.Mana         = Mana;
            this.ActionEffect = ActionEffect;
            if (ActionEffect != null)
            {
                ActionEffect.Name = Name;
                ActionEffect.SetElement(Element);
            }

            Style = "attacked";
        }
コード例 #2
0
        public List <SceneAnimation> RemoveEffect(BattleEffect Effect, bool NaturalRemoval)
        {
            List <SceneAnimation> Animations = new List <SceneAnimation>();

            AllEffects[Effect.CurrentPlacement].RemoveEffect(Effect);
            foreach (EffectScript Script in Effect.Scripts)
            {
                if (NaturalRemoval)
                {
                    if (Script.Trigger == EffectTrigger.ON_EFFECT_TIMEOUT)
                    {
                        Animations.AddRange(InterpretEffect(Effect, Script, Effect.User, null, Effect.CurrentPlacement));
                    }

                    if (Script.Trigger == EffectTrigger.ON_STAND_EXIT)
                    {
                        if (Effect.CurrentPlacement == Player1.Placement && !AllEffects[Player1.Placement].HasEffectGroup(Effect.GetEffectGroup()))
                        {
                            if (Effect.EffectAnimation != null)
                            {
                                Animations.Add(Effect.EffectAnimation);
                            }
                            Animations.AddRange(InterpretEffect(Effect, Script, Effect.User, Player1, Effect.CurrentPlacement));
                        }
                        else if (Effect.CurrentPlacement == Player2.Placement && !AllEffects[Player2.Placement].HasEffectGroup(Effect.GetEffectGroup()))
                        {
                            if (Effect.EffectAnimation != null)
                            {
                                Animations.Add(Effect.EffectAnimation);
                            }
                            Animations.AddRange(InterpretEffect(Effect, Script, Effect.User, Player2, Effect.CurrentPlacement));
                        }
                    }

                    SortedEffects[Script.Trigger][Script.Speed].Remove(Effect);

                    if (Effect.CurrentPlacement < 8)
                    {
                        Interpreter.SetPrevElement(Effect.Element); //TODO: HIGHLY LIKELY A BETTER WAY OF DOING ALL THIS
                        Animations.AddRange(RunTriggerTypeEffect(EffectTrigger.ON_OTHER_EFFECT_TIMEOUT, Effect.User, true));
                    }
                }
                else
                {
                    if (Script.Trigger == EffectTrigger.ON_EFFECT_EXIT)
                    {
                        Interpreter.SetPrevElement(Effect.Element);
                        Animations.AddRange(InterpretEffect(Effect, Script, Effect.User, null, Effect.CurrentPlacement));
                    }

                    if (Script.Trigger == EffectTrigger.ON_STAND_EXIT)
                    {
                        if (Effect.CurrentPlacement == Player1.Placement && !AllEffects[Player1.Placement].HasEffectGroup(Effect.GetEffectGroup()))
                        {
                            if (Effect.EffectAnimation != null)
                            {
                                Animations.Add(Effect.EffectAnimation);
                            }
                            Animations.AddRange(InterpretEffect(Effect, Script, Effect.User, Player1, Effect.CurrentPlacement));
                        }
                        else if (Effect.CurrentPlacement == Player2.Placement && !AllEffects[Player2.Placement].HasEffectGroup(Effect.GetEffectGroup()))
                        {
                            if (Effect.EffectAnimation != null)
                            {
                                Animations.Add(Effect.EffectAnimation);
                            }
                            Animations.AddRange(InterpretEffect(Effect, Script, Effect.User, Player2, Effect.CurrentPlacement));
                        }
                    }

                    SortedEffects[Script.Trigger][Script.Speed].Remove(Effect);

                    if (Effect.CurrentPlacement < 8)
                    {
                        Interpreter.SetPrevElement(Effect.Element);
                        Animations.AddRange(RunTriggerTypeEffect(EffectTrigger.ON_OTHER_EFFECT_EXIT, Effect.User, true));
                    }
                }
            }
            if (Effect.CurrentPlacement < 8)
            {
                Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.REMOVE_EFFECT, new double[] { Effect.CurrentPlacement, Effect.GetEffectGroup() }, Effect.Name));
            }

            return(Animations);
        }
コード例 #3
0
        public List <SceneAnimation> AddEffect(BattleEffect OriginalEffect, Player User)
        {
            List <SceneAnimation> Animations = new List <SceneAnimation>();

            foreach (byte Placement in OriginalEffect.Placement)
            {
                BattleEffect Effect = new BattleEffect(OriginalEffect, User);

                if (Placement < 8)
                {
                    if (Effect.User == Player1)
                    {
                        Effect.CurrentPlacement = (byte)((Placement + ArenaOrientation) % 8);
                    }
                    else
                    {
                        Effect.CurrentPlacement = (byte)((Placement + ArenaOrientation + 4) % 8);
                    }
                }

                if (AllEffects[Effect.CurrentPlacement].CanAddEffect())
                {
                    Effect.SetEffectGroup(EffectGroups);
                    foreach (EffectScript Script in Effect.Scripts)
                    {
                        if (Script.Trigger == EffectTrigger.ON_EFFECT_ENTER)
                        {
                            Animations.AddRange(InterpretEffect(Effect, Script, User, null, Effect.CurrentPlacement));
                        }
                    }
                    if (Placement < 8)
                    {
                        Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_EFFECT, new double[] { Effect.CurrentPlacement, Effect.GetEffectGroup() }, Effect.Name));
                        Animations.AddRange(RunTriggerTypeEffect(EffectTrigger.ON_NEW_TILE_PLACED, User, true));
                        foreach (EffectScript Script in Effect.Scripts)
                        {
                            if (Script.Trigger == EffectTrigger.ON_STAND_ENTER)
                            {
                                if (Effect.CurrentPlacement == Player1.Placement && !AllEffects[Player1.Placement].HasEffectGroup(Effect.GetEffectGroup()))
                                {
                                    if (Effect.EffectAnimation != null)
                                    {
                                        Animations.Add(Effect.EffectAnimation);
                                    }
                                    Animations.AddRange(InterpretEffect(Effect, Script, Effect.User, Player1, Effect.CurrentPlacement));
                                }
                                else if (Effect.CurrentPlacement == Player2.Placement && !AllEffects[Player2.Placement].HasEffectGroup(Effect.GetEffectGroup()))
                                {
                                    if (Effect.EffectAnimation != null)
                                    {
                                        Animations.Add(Effect.EffectAnimation);
                                    }
                                    Animations.AddRange(InterpretEffect(Effect, Script, Effect.User, Player2, Effect.CurrentPlacement));
                                }
                            }
                        }
                        if (Effect.User == Player1)
                        {
                            AllEffects[(Placement + ArenaOrientation) % 8].AddEffect(Effect);
                            Animations.AddRange(RunTilePlacedOnTopEffect(Effect.CurrentPlacement, User));
                        }
                        else
                        {
                            AllEffects[(Placement + ArenaOrientation + 4) % 8].AddEffect(Effect);
                            Animations.AddRange(RunTilePlacedOnTopEffect(Effect.CurrentPlacement, User));
                        }
                    }
                    else if (Placement == 8)
                    {
                        //TODO: CENTRE EFFECTS
                    }
                    else if (Placement == 9)
                    {
                        if (Effect.User == Player1)
                        {
                            AllEffects[9].AddEffect(Effect);
                            Effect.CurrentPlacement = 9;
                        }
                        else
                        {
                            AllEffects[10].AddEffect(Effect);
                            Effect.CurrentPlacement = 10;
                        }
                    }
                    else
                    {
                        if (Effect.User == Player1)
                        {
                            AllEffects[10].AddEffect(Effect);
                            Effect.CurrentPlacement = 10;
                        }
                        else
                        {
                            AllEffects[9].AddEffect(Effect);
                            Effect.CurrentPlacement = 9;
                        }
                    }

                    Animations.AddRange(RunTriggerTypeEffect(EffectTrigger.ON_OTHER_EFFECT_ENTER, User, true));

                    foreach (EffectScript Script in Effect.Scripts)
                    {
                        List <BattleEffect> Effects;
                        if (SortedEffects[Script.Trigger].ContainsKey(Script.Speed))
                        {
                            Effects = SortedEffects[Script.Trigger][Script.Speed];
                        }
                        else
                        {
                            Effects = new List <BattleEffect>();
                            SortedEffects[Script.Trigger].Add(Script.Speed, Effects);
                        }
                        Effects.Add(Effect);
                    }
                }
            }
            EffectGroups++;
            return(Animations);
        }
コード例 #4
0
 public abstract void SetNewFrame(BattleEffect Effect, Player User, Player Opponent, Player Trigger, byte TriggerPosition);
コード例 #5
0
 public abstract void SetEffect(BattleEffect Effect);
コード例 #6
0
 public override void SetEffect(BattleEffect Effect)
 {
     CurrentEffect = Effect;
     SetElement(Effect.Element);
     SetBaseAttacks(Effect.BasePhysical, Effect.BaseMystical);
 }
コード例 #7
0
        public override void SetNewFrame(BattleEffect Effect, Player User, Player Opponent, Player Trigger, byte TriggerPosition)
        {
            InterpreterFrame Frame = new InterpreterFrame(this, Effect, User, Opponent, Trigger, TriggerPosition);

            Frames.Add(Frame);
        }