Esempio n. 1
0
        public override IEnumerator <YieldInstruction> Apply(GameEventOwner owner, Character ownerChar, BattleContext context)
        {
            if (context.ContextStates.Contains <Redirected>())
            {
                yield break;
            }

            if (context.ActionType == BattleActionType.Trap || context.ActionType == BattleActionType.Item)
            {
                yield break;
            }

            if (Element != 00 && context.Data.Element != Element)
            {
                yield break;
            }

            Character targetChar = ZoneManager.Instance.CurrentMap.GetCharAtLoc(context.ExplosionTile);

            if (targetChar == null)
            {
                yield break;
            }

            //the attack needs to be able to hit foes
            if ((context.HitboxAction.TargetAlignments & Alignment.Foe) == Alignment.None)
            {
                yield break;
            }

            //original target char needs to be a friend of the target char
            if ((DungeonScene.Instance.GetMatchup(ownerChar, targetChar) & DrawFrom) == Alignment.None)
            {
                yield break;
            }

            CharAnimSpin spinAnim = new CharAnimSpin();

            spinAnim.CharLoc   = ownerChar.CharLoc;
            spinAnim.CharDir   = ownerChar.CharDir;
            spinAnim.MajorAnim = true;

            yield return(CoroutineManager.Instance.StartCoroutine(ownerChar.StartAnim(spinAnim)));

            yield return(new WaitWhile(ownerChar.OccupiedwithAction));

            DungeonScene.Instance.LogMsg(String.Format(Msg.ToLocal(), ownerChar.GetDisplayName(false), owner.GetDisplayName()));
            context.ExplosionTile   = ownerChar.CharLoc;
            context.Explosion.Range = 0;
            context.ContextStates.Set(new Redirected());
        }
Esempio n. 2
0
        public override IEnumerator <YieldInstruction> Apply(GameEventOwner owner, Character ownerChar, Character character, MapStatus status, bool msg)
        {
            if (status != owner || character != null)
            {
                yield break;
            }

            if (msg)
            {
                SkillData entry = DataManager.Instance.GetSkill(status.StatusStates.GetWithDefault <MapIndexState>().Index);
                DungeonScene.Instance.LogMsg(String.Format(Message.ToLocal(), entry.GetIconName()));
                yield return(new WaitForFrames(GameManager.Instance.ModifyBattleSpeed(10)));
            }
        }
Esempio n. 3
0
        public override IEnumerator <YieldInstruction> Apply(GameEventOwner owner, Character ownerChar, Character character, MapStatus status, bool msg)
        {
            if (status != owner || character != null)
            {
                yield break;
            }

            if (msg)
            {
                DungeonScene.Instance.LogMsg(Message.ToLocal());
                if (Delay)
                {
                    yield return(new WaitForFrames(GameManager.Instance.ModifyBattleSpeed(10)));
                }
            }
        }
Esempio n. 4
0
        protected override BattleContext CreateContext(GameEventOwner owner, Character ownerChar, BattleContext context)
        {
            Character target = (AffectTarget ? context.Target : context.User);
            int       damage = context.GetContextStateInt <DamageDealt>(0);

            if (damage > 0 && ownerChar != context.User)
            {
                //the attack needs to face the foe, and *auto-target*
                Dir8 attackDir = DirExt.GetDir(ownerChar.CharLoc, target.CharLoc);
                ownerChar.CharDir = attackDir;
                Loc frontLoc = ownerChar.CharLoc + attackDir.GetLoc() * FrontOffset;

                SkillData entry = DataManager.Instance.GetSkill(InvokedMove);

                DungeonScene.Instance.LogMsg(String.Format(Msg.ToLocal(), ownerChar.GetDisplayName(false), context.User.GetDisplayName(false)));

                BattleContext newContext = new BattleContext(BattleActionType.Skill);
                newContext.User      = ownerChar;
                newContext.UsageSlot = BattleContext.FORCED_SLOT;

                newContext.StartDir = newContext.User.CharDir;

                //fill effects
                newContext.Data         = new BattleData(entry.Data);
                newContext.Data.ID      = InvokedMove;
                newContext.Explosion    = new ExplosionData(entry.Explosion);
                newContext.HitboxAction = entry.HitboxAction.Clone();
                //make the attack *autotarget*; set the offset to the space between the front loc and the target
                newContext.HitboxAction.HitOffset = target.CharLoc - frontLoc;
                newContext.Strikes = entry.Strikes;
                newContext.Item    = new InvItem();
                //don't set move message, just directly give the message of what the move turned into

                //add a tag that will allow the moves themselves to switch to their offensive versions
                newContext.ContextStates.Set(new FollowUp());


                return(newContext);
            }

            return(null);
        }
Esempio n. 5
0
        public override IEnumerator <YieldInstruction> Apply(GameEventOwner owner, Character ownerChar, BattleContext context)
        {
            //only block explosions
            if (context.Explosion.Range == 0)
            {
                yield break;
            }

            //make sure to exempt Round.

            DungeonScene.Instance.LogMsg(String.Format(Msg.ToLocal(), ownerChar.GetDisplayName(false)));
            context.Explosion.Range       = 0;
            context.Explosion.ExplodeFX   = new BattleFX();
            context.Explosion.Emitter     = new EmptyCircleSquareEmitter();
            context.Explosion.TileEmitter = new EmptyFiniteEmitter();
            if (Div > 0)
            {
                context.AddContextStateMult <DmgMult>(false, 1, Div);
            }
            else
            {
                context.AddContextStateMult <DmgMult>(false, Div, 1);
            }
        }