예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <param name="Target"></param>
        public StateBuff(CastInfos CastInfos, AbstractFighter Target)
            : base(CastInfos, Target, ActiveType.ACTIVE_STATS, DecrementType.TYPE_ENDTURN)
        {
            var damageValue = 0;

            ApplyEffect(ref damageValue);
        }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fighter"></param>
 /// <param name="castInfos"></param>
 public override void CheckSpell(AbstractFighter fighter, CastInfos castInfos)
 {
     if (castInfos.EffectType == EffectEnum.AddLife && castInfos.Target != null && castInfos.Target.Team == fighter.Team)
     {
         base.OnFailed(fighter.Name);
     }
 }
예제 #3
0
        public override async Task Handle()
        {
            string[] separador_posiciones = _package.Substring(4).Split('|');
            int      id_entidad;
            short    celda;
            var      mapa = _account.Character.Map;

            foreach (string posicion in separador_posiciones)
            {
                id_entidad = int.Parse(posicion.Split(';')[0]);
                celda      = short.Parse(posicion.Split(';')[1]);

                if (id_entidad == _account.Character.Id)
                {
                    if (_account.Character.IsAutoClick)
                    {
                        _account.Send("GR1");//boton listo
                    }
                }

                AbstractFighter fighter = _account.Character.Fight.GetFighterById(id_entidad);
                if (fighter != null)
                {
                    _account.Character.Fight.UpdateCellFighter(fighter, celda);
                }
            }
        }
예제 #4
0
    private IEnumerator RemoveTag()
    {
        yield return(new WaitForSeconds(5));

        hitTagged = null;
        Debug.Log("Untagging");
    }
예제 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fighter"></param>
 public override void EndTurn(AbstractFighter fighter)
 {
     if (fighter.Cell.Id != m_cellId)
     {
         base.OnFailed(fighter.Name);
     }
 }
예제 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fighter"></param>
 public override void EndTurn(AbstractFighter fighter)
 {
     if (fighter.Team.AliveFighters.Count() != fighter.Team.Fighters.Count)
     {
         base.OnFailed(fighter.Name);
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="beginCell"></param>
 /// <param name="endCell"></param>
 /// <param name="length"></param>
 public override void CheckMovement(AbstractFighter fighter, int beginCell, int endCell, int length)
 {
     if(length != 1 || m_hasMoved)            
         base.OnFailed(fighter.Name);            
     else            
         m_hasMoved = true;            
 }
예제 #8
0
 /// <summary>
 /// Adds the fighter to this ledge's list of grabbed fighters, obeying rules set
 /// in the settings. Triggers the fighters LedgeGrab function.
 /// </summary>
 /// <param name="fighter"></param>
 void FighterGrabs(AbstractFighter fighter)
 {
     if (fighters_grabbed.Count == 0) //If there's no conflict, we just let him grab
     {
         fighters_grabbed.Add(fighter);
         fighter.SendMessage("GrabLedge", this);
     }
     else
     {
         string conflict = Settings.current_settings.conflict_type;
         if (conflict == "Share")
         {
             fighters_grabbed.Add(fighter);
             fighter.SendMessage("GrabLedge", this);
         }
         else if (conflict == "Hog")
         {
             return; //The grabbing fighter entirely ignores the ledge if he can't grab it
         }
         else if (conflict == "Trump")
         {
             foreach (AbstractFighter other in fighters_grabbed)
             {
                 FighterLeaves(other);
                 other.SendMessage("GetTrumped", this);
             }
             fighters_grabbed.Add(fighter);
             fighter.SendMessage("GrabLedge", this);
         }
     }
 }
예제 #9
0
        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="fighter"></param>
        ///// <param name="nearestEnnemies"></param>
        ///// <returns></returns>
        private static int TryTacle(AbstractFighter fighter, IEnumerable <AbstractFighter> nearestEnnemies)
        {
            var fighterAgility  = fighter.Statistics.GetTotal(EffectEnum.AddAgility);
            int ennemiesAgility = 0;

            foreach (var ennemy in nearestEnnemies)
            {
                if (!ennemy.StateManager.HasState(FighterStateEnum.STATE_ROOTED))
                {
                    ennemiesAgility += ennemy.Statistics.GetTotal(EffectEnum.AddAgility);
                }
            }

            var A = fighterAgility + 25;
            var B = fighterAgility + ennemiesAgility + 50;

            if (B == 0)
            {
                B = 1;
            }
            var chance = (int)((long)(300 * A / B) - 100);
            var rand   = Pathfinding.PATHFIND_RANDOM.Next(0, 99);

            return(rand > chance ? rand : -1);
        }
예제 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fight"></param>
        /// <param name="fighter"></param>
        /// <param name="currentCell"></param>
        /// <param name="encodedPath"></param>
        /// <returns></returns>
        public static MovementPath IsValidPath(AbstractFight fight, AbstractFighter fighter, int currentCell, string encodedPath)
        {
            if (encodedPath == "")
            {
                return(null);
            }

            var decodedPath = DecodePath(fight.Map, currentCell, encodedPath);
            var finalPath   = new MovementPath();

            var index       = 0;
            int transitCell = 0;

            do
            {
                transitCell = decodedPath.TransitCells[index];
                var length = Pathfinding.IsValidLine(fight, fighter, finalPath, transitCell, decodedPath.GetDirection(transitCell), decodedPath.TransitCells[index + 1]);
                if (length == -1)
                {
                    return(null);
                }
                else if (length == -2)
                {
                    break;
                }
                index++;
            }while (transitCell != decodedPath.LastStep);

            return(finalPath);
        }
예제 #11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fighter"></param>
 public override void EndTurn(AbstractFighter fighter)
 {
     if (fighter.AP > 0)
     {
         base.OnFailed(fighter.Name);
     }
 }
예제 #12
0
 public static void MoveState(AbstractFighter actor)
 {
     if (actor.CheckSmash("ForwardSmash"))
     {
         actor.doAction("Dash");
     }
     //float direction = actor.GetControllerAxis("Horizontal") * actor.facing;
     //shield
     if (actor.KeyBuffered("Attack"))
     {
         actor.doGroundAttack();
     }
     if (actor.KeyBuffered("Special"))
     {
         actor.doGroundSpecial();
     }
     if (actor.KeyBuffered("Jump"))
     {
         actor.doAction("Jump");
     }
     // else if (actor.DirectionHeld("Down"))
     //     actor.doAction("Crouch");
     else if (actor.GetAxis("Horizontal") == 0.0f)
     {
         actor.doAction("Stop");
     }
     if (actor.KeyBuffered(InputTypeUtil.GetBackward(actor.getBattleObject())))
     {
         actor.SendMessage("flip"); //TODO PIVOT
     }
     //Two other kinds of stop? Not sure if these are needed
 }
예제 #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public SkinChangeBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_STATS, DecrementType.TYPE_ENDTURN)
        {
            var damageValue = 0;

            ApplyEffect(ref damageValue);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public PandaCarrierBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_ENDMOVE, DecrementType.TYPE_ENDMOVE)
        {
            Caster.StateManager.AddState(this);

            castInfos.Caster.Fight.Dispatch(WorldMessage.GAME_ACTION(EffectEnum.PandaCarrier, castInfos.Caster.Id, target.Id.ToString()));
        }
예제 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public PandaCarriedBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_ENDMOVE, DecrementType.TYPE_ENDMOVE)
        {
            Target.StateManager.AddState(this);

            Target.SetCell(Caster.Cell);
        }
예제 #16
0
 public static void AirState(AbstractFighter actor)
 {
     StateTransitions.AirControl(actor);
     if (actor.KeyBuffered("Shield") && actor.GetIntVar(TussleConstants.FighterVariableNames.AIR_DODGES_REMAINING) >= 1)
     {
         //actor.doAction("AirDodge");
     }
     if (actor.KeyBuffered("Attack"))
     {
         actor.doAirAttack();
     }
     if (actor.KeyBuffered("Special"))
     {
         actor.doAirSpecial();
     }
     if (actor.KeyBuffered("Jump") && actor.GetIntVar(TussleConstants.FighterVariableNames.JUMPS_REMAINING) > 0)
     {
         actor.doAction("AirJump");
     }
     actor.SendMessage("CheckForGround");
     if (actor.GetBoolVar(TussleConstants.FighterVariableNames.IS_GROUNDED) && actor.ground_elasticity == 0 && actor.GetIntVar("tech_window") == 0)
     {
         actor.BroadcastMessage("ChangeXPreferred", 0.0f, SendMessageOptions.RequireReceiver);
         actor.BroadcastMessage("ChangeYPreferred", actor.GetFloatVar(TussleConstants.FighterAttributes.MAX_FALL_SPEED));
         actor.doAction("Land");
     }
     //TODO fastfal
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public PandaCarriedBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_ENDMOVE, DecrementType.TYPE_ENDMOVE)
        {
            Target.StateManager.AddState(this);

            Target.SetCell(Caster.Cell);
        }
예제 #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public PandaCarrierBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_ENDMOVE, DecrementType.TYPE_ENDMOVE)
        {
            Caster.StateManager.AddState(this);

            castInfos.Caster.Fight.Dispatch(WorldMessage.GAME_ACTION(EffectEnum.PandaCarrier, castInfos.Caster.Id, target.Id.ToString()));
        }
예제 #19
0
    public void GetHit(Hitbox hitbox)
    {
        if (LockHitbox(hitbox)) //If the hitbox is not already locked to us
        {
            //Gah! A non-initialization getcomponent! Kill it with fire!
            //...as soon as I figure out HOW
            AbstractFighter otherFighter = hitbox.owner.GetComponent <AbstractFighter>();
            if (otherFighter != null)
            {
                hitTagged = otherFighter;
                if (hitTagCoroutine != null)
                {
                    StopCoroutine(hitTagCoroutine);
                }
                hitTagCoroutine = RemoveTag();
                StartCoroutine(hitTagCoroutine);
            }

            float weight_constant = 1.4f;
            float flat_constant   = 5.0f;

            float percent_portion = (damage_percent / 10.0f) + ((damage_percent * hitbox.damage) / 20.0f);
            float weight_portion  = 200.0f / (GetFloatVar(TussleConstants.FighterAttributes.WEIGHT) * hitbox.weight_influence + 100);
            float scaled_kb       = (((percent_portion * weight_portion * weight_constant) + flat_constant) * hitbox.knockback_growth);
            ApplyKnockback(scaled_kb + hitbox.base_knockback, hitbox.trajectory);
            DealDamage(hitbox.damage);
            ApplyHitstop(hitbox.damage);//TODO hitlag multiplier
            if (hitbox.owner != null)
            {
                hitbox.owner.SendMessage("ApplyHitstop", hitbox.damage);
            }
            ApplyHitstun(scaled_kb + hitbox.base_knockback, 1.0f, 1.0f, hitbox.trajectory);
        }
    }
예제 #20
0
    public void AddComponent(string componentType, string componentJSON)
    {
        switch (componentType)
        {
        case "AbstractFighter":
            AbstractFighter abstractFighter = GetComponent <AbstractFighter>();
            if (abstractFighter == null)
            {
                abstractFighter = gameObject.AddComponent <AbstractFighter>();
            }
            JsonUtility.FromJsonOverwrite(componentJSON, abstractFighter);
            break;

        case "ActionHandler":
            ActionHandler actionHandler = GetComponent <ActionHandler>();
            if (actionHandler == null)
            {
                actionHandler = gameObject.AddComponent <ActionHandler>();
            }
            JsonUtility.FromJsonOverwrite(componentJSON, actionHandler);
            break;

        default:
            PrintDebug(this, 1, "Battle Component of Unrecognized type in JSON: " + componentType);
            BattleComponent comp = gameObject.AddComponent <BattleComponent>();
            JsonUtility.FromJsonOverwrite(componentJSON, comp);
            break;
        }
    }
    public BattleObject LoadFighter(int player_num)
    {
        GameObject   obj       = new GameObject();
        BattleObject battleObj = obj.AddComponent <BattleObject>();

        if (abstract_fighter_info != null)
        {
            AbstractFighter fighter = obj.AddComponent <AbstractFighter>();
        }
        if (sprite_handler_info != null)
        {
            SpriteHandler sprite = obj.AddComponent <SpriteHandler>();
            //sprite.orientation = sprite_handler_info.orientation;
        }
        if (action_handler_info != null)
        {
            ActionHandler actions = obj.AddComponent <ActionHandler>();
            //actions.action_json = action_handler_info.action_json;
            //actions.starting_action = action_handler_info.starting_action;
        }
        if (motion_handler_info != null)
        {
            MotionHandler mot = obj.AddComponent <MotionHandler>();
        }
        if (ecb_info != null)
        {
            //EnvironmentCollider ecb = obj.AddComponent<EnvironmentCollider>();
        }
        foreach (VarData vardata in variables)
        {
            battleObj.SetVar(vardata.name, vardata.value);
        }
        battleObj.LoadComponents();
        return(battleObj);
    }
예제 #22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public SkinChangeBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_STATS, DecrementType.TYPE_ENDTURN)
        {
            var damageValue = 0;

            ApplyEffect(ref damageValue);
        }
예제 #23
0
    public static void CrouchGetupState(AbstractFighter actor)
    {
        if (actor.KeyBuffered("Shield"))
        {
            //TODO forward backward roll
        }
        if (actor.KeyBuffered("Attack"))
        {
            if (actor.CheckSmash("DownSmash"))
            {
                actor.doAction("DownSmash");
            }
            else
            {
                actor.doAction("DownAttack");
            }
        }

        if (actor.KeyBuffered("Special"))
        {
            actor.doAction("DownSpecial");
        }
        if (actor.KeyBuffered("Jump"))
        {
            actor.doAction("Jump");
        }
    }
예제 #24
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <param name="Target"></param>
        public StateBuff(CastInfos CastInfos, AbstractFighter Target)
            : base(CastInfos, Target, ActiveType.ACTIVE_STATS, DecrementType.TYPE_ENDTURN)
        {
            var damageValue = 0;

            ApplyEffect(ref damageValue);
        }
예제 #25
0
 public AbstractFighter GetAbstractFighter()
 {
     if (abstractFighter == null)
     {
         abstractFighter = GetComponent <AbstractFighter>();
     }
     return(abstractFighter);
 }
예제 #26
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fighter"></param>
 public override void EndTurn(AbstractFighter fighter)
 {
     if (!m_hasMoved)
     {
         OnFailed(fighter.Name);
     }
     m_hasMoved = false;
 }
예제 #27
0
 public static void CheckGround(AbstractFighter actor)
 {
     actor.SendMessage("CheckForGround");
     if (!actor.GetBoolVar(TussleConstants.FighterVariableNames.IS_GROUNDED))
     {
         actor.doAction("Fall");
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 /// <param name="castInfos"></param>
 public override void CheckSpell(AbstractFighter fighter, Effect.CastInfos castInfos)
 {
     if((castInfos.EffectType == Spell.EffectEnum.SubPO ||
         castInfos.EffectType == Spell.EffectEnum.POSteal) &&
         castInfos.Target != null &&
         castInfos.Target.Team != fighter.Team)            
         base.OnFailed(fighter.Name);            
 }
예제 #29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        /// <param name="direction"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static FightActionResultEnum ApplyPush(CastInfos castInfos, AbstractFighter target, int direction, int length)
        {
            var currentCell = target.Cell;

            for (int i = 0; i < length; i++)
            {
                var nextCell = target.Fight.GetCell(Pathfinding.NextCell(castInfos.Map, currentCell.Id, direction));

                if (nextCell != null && nextCell.CanWalk)
                {
                    if (nextCell.HasObject(FightObstacleTypeEnum.TYPE_TRAP))
                    {
                        target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + nextCell.Id));

                        target.Fight.SetSubAction(() =>
                        {
                            return(target.SetCell(nextCell));
                        }, 1 + ++i * WorldConfig.FIGHT_PUSH_CELL_TIME);

                        return(FightActionResultEnum.RESULT_NOTHING);
                    }
                }
                else
                {
                    if (i != 0)
                    {
                        target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));
                    }

                    target.Fight.SetSubAction(() =>
                    {
                        if (castInfos.EffectType == EffectEnum.PushBack)
                        {
                            var pushResult = PushEffect.ApplyPushBackDamages(castInfos, target, length, i);
                            if (pushResult != FightActionResultEnum.RESULT_NOTHING)
                            {
                                return(pushResult);
                            }
                        }

                        return(target.SetCell(currentCell));
                    }, 1 + (i * WorldConfig.FIGHT_PUSH_CELL_TIME));

                    return(FightActionResultEnum.RESULT_NOTHING);
                }

                currentCell = nextCell;
            }

            target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));

            target.Fight.SetSubAction(() =>
            {
                return(target.SetCell(currentCell));
            }, 1 + length * WorldConfig.FIGHT_PUSH_CELL_TIME);

            return(FightActionResultEnum.RESULT_NOTHING);
        }
예제 #30
0
 public static void CrouchState(AbstractFighter actor)
 {
     //The getup state has everything we need, except for actually calling "getup" so we use that, and then add our extra bit at the end
     CrouchGetupState(actor);
     if (!actor.DirectionHeld("Down"))
     {
         actor.doAction("CrouchGetup");
     }
 }
예제 #31
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fighter"></param>
        public override void EndTurn(AbstractFighter fighter)
        {
            var nearestFighters = Pathfinding.GetFightersNear(fighter.Fight, fighter.Cell.Id);

            if (nearestFighters.Where(f => f.Team == fighter.Team).Count() == 0)
            {
                base.OnFailed(fighter.Name);
            }
        }
예제 #32
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fighter"></param>
        public override void EndTurn(AbstractFighter fighter)
        {
            var nearestEnnemis = Pathfinding.GetEnnemiesNear(fighter.Fight, fighter.Team, fighter.Cell.Id);

            if (nearestEnnemis.Count() == 0)
            {
                base.OnFailed(fighter.Name);
            }
        }
예제 #33
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        /// <param name="direction"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static FightActionResultEnum ApplyPush(CastInfos castInfos, AbstractFighter target, int direction, int length)
        {
            var currentCell = target.Cell;

            for (int i = 0; i < length; i++)
            {
                var nextCell = target.Fight.GetCell(Pathfinding.NextCell(castInfos.Map, currentCell.Id, direction));

                if (nextCell != null && nextCell.CanWalk)
                {
                    if (nextCell.HasObject(FightObstacleTypeEnum.TYPE_TRAP))
                    {
                        target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + nextCell.Id));

                        target.Fight.SetSubAction(() =>
                        {
                            return target.SetCell(nextCell);
                        }, 1 + ++i * WorldConfig.FIGHT_PUSH_CELL_TIME);

                        return FightActionResultEnum.RESULT_NOTHING;
                    }
                }
                else
                {
                    if (i != 0)
                    {
                        target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));
                    }

                    target.Fight.SetSubAction(() =>
                    {
                        if (castInfos.EffectType == EffectEnum.PushBack)
                        {
                            var pushResult = PushEffect.ApplyPushBackDamages(castInfos, target, length, i);
                            if (pushResult != FightActionResultEnum.RESULT_NOTHING)
                                return pushResult;
                        }

                        return target.SetCell(currentCell);
                    }, 1 + (i * WorldConfig.FIGHT_PUSH_CELL_TIME));

                    return FightActionResultEnum.RESULT_NOTHING;
                }

                currentCell = nextCell;
            }

            target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));

            target.Fight.SetSubAction(() =>
            {
                return target.SetCell(currentCell);
            }, 1 + length * WorldConfig.FIGHT_PUSH_CELL_TIME);

            return FightActionResultEnum.RESULT_NOTHING;
        }
예제 #34
0
    public override void Update()
    {
        base.Update();
        //These classes will be phased out as time goes on. Until then, we need to just exit early if we're in the builder since these don't actually use Subactions
        if (isInBuilder)
        {
            return;
        }
        AbstractFighter fighter = actor.GetAbstractFighter();

        if (current_frame > 15 && actor.GetAbstractFighter().KeyBuffered("Shield", 5) && GetIntVar("tech_cooldown") == 0 && !actor.GetBoolVar(TussleConstants.FighterVariableNames.IS_GROUNDED))
        {
            actor.SetVar("tech_window", 12);
            //anti_grab = statusEffect.TemporaryHitFilter(_actor, hurtbox.GrabImmunity(_actor), 10)
            //anti_grab.activate()
            SetVar("tech_cooldown", 40);
        }
        if (actor.GetIntVar("tech_window") > 0)
        {
            actor.SetVar("elasticity", 0.0f);
        }
        else
        {
            actor.SetVar("elasticity", actor.GetVarData(TussleConstants.FighterAttributes.HITSTUN_ELASTICITY));
        }
        SetVar("feet_planted", actor.GetBoolVar(TussleConstants.FighterVariableNames.IS_GROUNDED));
        if (GetIntVar("tech_cooldown") > 0)
        {
            SetVar("tech_cooldown", GetIntVar("tech_cooldown") - 1);
        }
        if (current_frame == 0)
        {
            //anti_grab = statusEffect.TemporaryHitFilter(_actor, hurtbox.GrabImmunity(_actor), 10)
            //anti_grab.activate()
            Vector2 directMagn = MotionHandler.GetDirectionMagnitude(actor.GetFloatVar(TussleConstants.MotionVariableNames.XSPEED), actor.GetFloatVar(TussleConstants.MotionVariableNames.XSPEED));
            if (directMagn.x != 0 && directMagn.x != 180)
            {
                actor.SetVar(TussleConstants.FighterVariableNames.IS_GROUNDED, false);
                if (directMagn.y > 10)
                {
                    actor.SendMessage("UnRotate");
                    actor.SendMessage("RotateSprite", (directMagn.x - 90) * actor.GetIntVar(TussleConstants.FighterVariableNames.FACING_DIRECTION));
                }
            }
            if (last_frame > 15) //If the hitstun is long enough
            {
                GameObject particles = ObjectPooler.current_pooler.GetPooledObject("LaunchTrail", actor.transform);
                particles.SetActive(true);
                if (fighter.hitTagged != null)
                {
                    particles.SendMessage("ChangeColor", Settings.current_settings.player_colors[fighter.hitTagged.GetIntVar(TussleConstants.FighterVariableNames.PLAYER_NUM)]);
                }
                particles.SendMessage("Play", last_frame);
            }
        }
    }
예제 #35
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fighter"></param>
 /// <param name="cellId"></param>
 /// <param name="spellId"></param>
 /// <param name="spellLevel"></param>
 /// <param name="sprite"></param>
 /// <param name="spriteInfos"></param>
 /// <param name="duration"></param>
 /// <param name="callback"></param>
 public GameFightSpellAction(AbstractFighter fighter, int cellId, int spellId, int spellLevel, string sprite, string spriteInfos, long duration, System.Action callback)
     : base(GameActionTypeEnum.FIGHT_SPELL_LAUNCH, fighter, duration)
 {
     Callback    = callback;
     CellId      = cellId;
     SpellId     = spellId;
     SpellLevel  = spellLevel;
     Sprite      = sprite;
     SpriteInfos = spriteInfos;
 }
예제 #36
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fighter"></param>
 /// <param name="castInfos"></param>
 public override void CheckSpell(AbstractFighter fighter, Effect.CastInfos castInfos)
 {
     if ((castInfos.EffectType == Spell.EffectEnum.SubPO ||
          castInfos.EffectType == Spell.EffectEnum.POSteal) &&
         castInfos.Target != null &&
         castInfos.Target.Team != fighter.Team)
     {
         base.OnFailed(fighter.Name);
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public override void CheckDeath(AbstractFighter fighter)
 {
     if (fighter.Id == TargetId)
     {
         base.OnSuccess();
     }
     else
     {
         base.OnFailed();
     }
 }
예제 #38
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="beginCell"></param>
 /// <param name="endCell"></param>
 /// <param name="length"></param>
 public override void CheckMovement(AbstractFighter fighter, int beginCell, int endCell, int length)
 {
     if (length != 1 || m_hasMoved)
     {
         base.OnFailed(fighter.Name);
     }
     else
     {
         m_hasMoved = true;
     }
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Effect"></param>
        public AbstractSpellBuff(CastInfos castInfos, AbstractFighter target, ActiveType activeType, DecrementType decrementType)
        {
            CastInfos = castInfos;
            Duration = target.Fight.CurrentFighter == target ? castInfos.Duration + 1 : castInfos.Duration;
            Caster = castInfos.Caster;
            Target = target;

            ActiveType = activeType;
            DecrementType = decrementType;

            switch (castInfos.EffectType)
            {
                case EffectEnum.ReflectSpell:
                    Target.Fight.Dispatch(WorldMessage.FIGHT_EFFECT_INFORMATION(CastInfos.EffectType,
                                                                               Target.Id,
                                                                               CastInfos.Value2.ToString(),
                                                                               CastInfos.Value2.ToString(),
                                                                               "10",
                                                                               CastInfos.Value2.ToString(),
                                                                               CastInfos.Duration.ToString(),
                                                                               CastInfos.SpellId.ToString()));
                    break;

                case EffectEnum.EcaflipChance:
                case EffectEnum.AddChatiment:
                    Target.Fight.Dispatch(WorldMessage.FIGHT_EFFECT_INFORMATION(CastInfos.EffectType,
                                                                           Target.Id,
                                                                           CastInfos.Value1.ToString(),
                                                                           CastInfos.Value2.ToString(),
                                                                           CastInfos.Value3.ToString(),
                                                                           "",
                                                                           CastInfos.Duration.ToString(),
                                                                           CastInfos.SpellId.ToString()));
                    break;

                case EffectEnum.PandaCarrier:
                    break;

                default:
                    Target.Fight.Dispatch(WorldMessage.FIGHT_EFFECT_INFORMATION(CastInfos.EffectType,
                                                                               Target.Id,
                                                                               CastInfos.Value1.ToString(),
                                                                               "",
                                                                               "",
                                                                               "",
                                                                               CastInfos.Duration.ToString(),
                                                                               CastInfos.SpellId.ToString()));
                    break;
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public override void CheckDeath(AbstractFighter fighter)
 {
     if (fighter.Id == TargetId)
     {
         if (fighter.Team.AliveFighters.Count() == 0)
         {
             base.OnSuccess();
         }
         else
         {
             base.OnFailed();
         }
     }
 }
예제 #41
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <param name="Heal"></param>
        /// <returns></returns>
        public static FightActionResultEnum ApplyHeal(CastInfos castInfos, AbstractFighter target, ref int heal)
        {
            var caster = castInfos.Caster;

            if(castInfos.EffectType != EffectEnum.DamageBrut)
                caster.CalculHeal(ref heal);

            if (target.Life + heal > target.MaxLife)
                heal = target.MaxLife - target.Life;

            target.Life += heal;

            castInfos.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.FIGHT_HEAL, caster.Id, target.Id + "," + heal));

            return castInfos.Fight.TryKillFighter(target, caster);
        }
예제 #42
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="effectType"></param>
 /// <param name="spellId"></param>
 /// <param name="cellId"></param>
 /// <param name="value1"></param>
 /// <param name="value2"></param>
 /// <param name="value3"></param>
 /// <param name="chance"></param>
 /// <param name="duration"></param>
 /// <param name="caster"></param>
 /// <param name="target"></param>
 /// <param name="rangeType"></param>
 /// <param name="targetKnownCellId"></param>
 /// <param name="spellLevel"></param>
 /// <param name="isMelee"></param>
 /// <param name="isTrap"></param>
 /// <param name="subEffect"></param>
 /// <param name="damageValue"></param>
 /// <param name="fakeValue"></param>
 public CastInfos(EffectEnum effectType,
     int spellId,
     int cellId,
     int value1,
     int value2,
     int value3,
     int chance,
     int duration,
     AbstractFighter caster,
     AbstractFighter target,
     string rangeType = "",
     int targetKnownCellId = 0,
     int spellLevel = -1,
     bool isMelee = false,
     bool isTrap = false,
     EffectEnum subEffect = EffectEnum.None,
     int damageValue = 0, int fakeValue = 0)
 {
     Fight = caster.Fight;
     Map = caster.Fight.Map;
     SpellLevel = spellLevel;
     TargetKnownCellId = targetKnownCellId;
     FakeValue = fakeValue;
     RangeType = rangeType;
     EffectType = effectType;
     SpellId = spellId;
     CellId = cellId;
     Value1 = value1;
     Value2 = value2;
     Value3 = value3;
     Chance = chance;
     IsTrap = isTrap;
     Duration = duration;
     Caster = caster;
     Target = target;
     if (subEffect == EffectEnum.None)
     {
         SubEffect = effectType;
     }
     else
     {
         SubEffect = subEffect;
     }
     DamageValue = damageValue;
     IsMelee = isMelee;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public override void EndTurn(AbstractFighter fighter)
 {
     if (fighter.AP > 0)
         base.OnFailed(fighter.Name);
 }
예제 #44
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public override void BeginTurn(AbstractFighter fighter)
 {
     m_cellId = fighter.Cell.Id;
 }
예제 #45
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public override void EndTurn(AbstractFighter fighter)
 {
     if (!m_hasMoved)
         OnFailed(fighter.Name);
     m_hasMoved = false;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public virtual void BeginTurn(AbstractFighter fighter)
 {
 }
예제 #47
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public override void EndTurn(AbstractFighter fighter)
 {
     if (fighter.Cell.Id != m_cellId)
         base.OnFailed(fighter.Name);
 }
예제 #48
0
 public DamageBuff(CastInfos castInfos, AbstractFighter target)
     : base(castInfos, target, ActiveType.ACTIVE_ENDTURN, DecrementType.TYPE_ENDTURN)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 /// <param name="castInfos"></param>
 public virtual void CheckSpell(AbstractFighter fighter, CastInfos castInfos)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public virtual void EndTurn(AbstractFighter fighter)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public override void EndTurn(AbstractFighter fighter)
 {
     var aroundFighters = Pathfinding.GetFightersNear(fighter.Fight, fighter.Cell.Id);
     if(aroundFighters.Where(f => f.Team == fighter.Team).Count() > 0)            
         base.OnFailed(fighter.Name);            
 }
예제 #52
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="CastInfos"></param>
 /// <param name="Target"></param>
 public PunishmentBuff(CastInfos CastInfos, AbstractFighter Target)
     : base(CastInfos, Target, ActiveType.ACTIVE_ATTACKED_AFTER_JET, DecrementType.TYPE_ENDTURN)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public override void EndTurn(AbstractFighter fighter)
 {
     if(fighter.Team.AliveFighters.Count() != fighter.Team.Fighters.Count)
         base.OnFailed(fighter.Name);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="beginCell"></param>
 /// <param name="endCell"></param>
 /// <param name="length"></param>
 public virtual void CheckMovement(AbstractFighter fighter, int beginCell, int endCell, int length)
 {
 }
 public ReflectSpellBuff(CastInfos castInfos, AbstractFighter target)
     : base(castInfos, target, ActiveType.ACTIVE_ATTACKED_AFTER_JET, DecrementType.TYPE_ENDTURN)
 {
 }
예제 #56
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public override void EndTurn(AbstractFighter fighter)
 {
     var nearestEnnemis = Pathfinding.GetEnnemiesNear(fighter.Fight, fighter.Team, fighter.Cell.Id);
     if(nearestEnnemis.Count() == 0)            
         base.OnFailed(fighter.Name);
 }
예제 #57
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="castInfos"></param>
 /// <param name="target"></param>
 public DamageDodgeBuff(CastInfos castInfos, AbstractFighter target)
     : base(castInfos, target, ActiveType.ACTIVE_ATTACKED_BEFORE_JET, DecrementType.TYPE_ENDTURN)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 /// <param name="weaponTemplate"></param>
 public virtual void CheckWeapon(AbstractFighter fighter, ItemTemplateDAO weaponTemplate)
 {
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="fighter"></param>
 public virtual void CheckDeath(AbstractFighter fighter)
 {
 }
 protected override bool CanRegenerate(AbstractFight fight, AbstractFighter fighter)
 {
     return fight.LoserFighters.Contains(fighter);
 }