Example #1
0
        private SpecialAttack DeploySpecialAttack()
        {
            if (Service.SimTimeEngine.IsPaused())
            {
                return(null);
            }
            BattleController battleController = Service.BattleController;

            if (battleController.BattleEndProcessing)
            {
                return(null);
            }
            if (battleController.GetPlayerDeployableSpecialAttackCount(this.currentSpecialAttackType.Uid) == 0)
            {
                Service.EventManager.SendEvent(EventId.TroopNotPlacedInvalidTroop, this.currentWorldPosition);
                return(null);
            }
            if (this.currentSpecialAttackType != null)
            {
                TeamType teamType = TeamType.Attacker;
                if (battleController.GetCurrentBattle().Type == BattleType.PveDefend)
                {
                    teamType = TeamType.Defender;
                }
                SpecialAttack specialAttack = Service.SpecialAttackController.DeploySpecialAttack(this.currentSpecialAttackType, teamType, this.currentWorldPosition, true);
                if (specialAttack != null)
                {
                    IntPosition boardPosition = Units.WorldToBoardIntPosition(this.currentWorldPosition);
                    battleController.OnSpecialAttackDeployed(this.currentSpecialAttackType.Uid, teamType, boardPosition);
                    Service.EventManager.SendEvent(EventId.SpecialAttackDeployed, specialAttack);
                    return(specialAttack);
                }
            }
            return(null);
        }
Example #2
0
        private void ApplySpecialAttackEquipmentBuffs(SpecialAttack specialAttack)
        {
            StaticDataController     staticDataController  = Service.StaticDataController;
            List <EquipmentEffectVO> equipmentBuffsForTeam = this.GetEquipmentBuffsForTeam(specialAttack.TeamType);
            int num = (equipmentBuffsForTeam == null) ? 0 : equipmentBuffsForTeam.Count;

            for (int i = 0; i < num; i++)
            {
                EquipmentEffectVO equipmentEffectVO = equipmentBuffsForTeam[i];
                if (equipmentEffectVO.BuffUids != null && equipmentEffectVO.AffectedSpecialAttackIds != null)
                {
                    int j    = 0;
                    int num2 = equipmentEffectVO.AffectedSpecialAttackIds.Length;
                    while (j < num2)
                    {
                        if (equipmentEffectVO.AffectedSpecialAttackIds[j] == specialAttack.VO.SpecialAttackID)
                        {
                            int k    = 0;
                            int num3 = equipmentEffectVO.BuffUids.Length;
                            while (k < num3)
                            {
                                BuffTypeVO buffVO = staticDataController.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[k]);
                                specialAttack.AddAppliedBuff(buffVO, BuffVisualPriority.Equipment);
                                k++;
                            }
                            break;
                        }
                        j++;
                    }
                }
            }
        }
Example #3
0
        private void UpdateSpeed(SpecialAttack specialAttack)
        {
            if (specialAttack.StarshipGameObject == null)
            {
                return;
            }
            IEnumerator enumerator = specialAttack.StarshipGameObject.GetComponent <Animation>().GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    AnimationState animationState = (AnimationState)enumerator.Current;
                    animationState.speed = this.speed;
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
        }
Example #4
0
        public Catcheur(string pseudo, CatcheurType type, CatcheurState state, SpecialAttack specialAtk)
        {
            // Init
            Pseudo        = pseudo;
            CatcheurType  = type;
            CatcheurState = state;

            switch (type)
            {
            case CatcheurType.Agile:
                Health    = 125;  //125
                maxHealth = 125;
                Attack    = 3;
                Defense   = 3;
                break;

            case CatcheurType.Brute:
                Health    = 100;  //100
                maxHealth = 100;
                Attack    = 5;
                Defense   = 1;
                break;
            }

            SpecialAtk = specialAtk;
        }
Example #5
0
        public SpecialAttack DeploySpecialAttack(SpecialAttackTypeVO specialAttackType, TeamType teamType, Vector3 worldPosition, bool playerDeployed)
        {
            this.boardPosition = Units.WorldToBoardIntPosition(worldPosition);
            if ((specialAttackType.IsDropship || specialAttackType.HasDropoff) && teamType == TeamType.Attacker)
            {
                if (Service.ShieldController.IsTargetCellUnderShield(worldPosition))
                {
                    Service.EventManager.SendEvent(EventId.TroopPlacedInsideShieldError, this.boardPosition);
                    return(null);
                }
                if (!Service.TroopController.FindValidDropShipTroopPlacementCell(this.boardPosition, teamType, 1, out this.boardPosition))
                {
                    Service.EventManager.SendEvent(EventId.TroopPlacedInsideBuildingError, this.boardPosition);
                    return(null);
                }
            }
            BoardCell cellAt = Service.BoardController.Board.GetCellAt(this.boardPosition.x, this.boardPosition.z);

            if (cellAt == null)
            {
                Service.EventManager.SendEvent(EventId.TroopNotPlacedInvalidArea, this.boardPosition);
                return(null);
            }
            base.EnsureBattlePlayState();
            Vector3       targetWorldPos = Units.BoardToWorldVec(this.boardPosition);
            SpecialAttack specialAttack  = new SpecialAttack(specialAttackType, teamType, targetWorldPos, cellAt.X, cellAt.Z, playerDeployed);

            specialAttack.TargetShield = Service.ShieldController.GetActiveShieldAffectingBoardPos(specialAttack.TargetBoardX, specialAttack.TargetBoardZ);
            this.specialAttacksDeployed.Enqueue(specialAttack);
            Service.EventManager.SendEvent(EventId.SpecialAttackSpawned, specialAttack);
            return(specialAttack);
        }
Example #6
0
        protected override void Awake()
        {
            base.Awake();

            var search       = new SearchForTarget(this, "Player");
            var moveToTarget = new MoveToTarget(this, moveSpeed, nextWaypointDistance
                                                , myRigidbody, spriteContainer);
            var idle          = new Idle();
            var specialAttack = new SpecialAttack(this, enemyAnimator);
            var death         = new Death(this, enemyAnimator);

            AddTransition(search, moveToTarget, TargetFound());
            AddTransition(search, idle, TargetMissing());
            //AddTransition(moveToTarget, search, IsStuck());
            AddTransition(moveToTarget, search, TargetMissing());
            AddTransition(idle, search, ShouldAttack());
            AddTransition(moveToTarget, specialAttack, InRangeToAttack());
            AddTransition(specialAttack, search, TargetOutofRange());

            AddAnyTransition(idle, () => !shouldAttackPlayer);
            AddAnyTransition(death, ReadyToDie());

            StateMachine.SetState(search);

            Func <bool> TargetMissing() => () => Target == null;
            Func <bool> IsStuck() => () => moveToTarget.TimeStuck > timeTillSearchWhenStuck;
            Func <bool> TargetFound() => () => Target != null;
            Func <bool> ShouldAttack() => () => shouldAttackPlayer; Func <bool> InRangeToAttack() => () => Target != null &&
            Mathf.Abs(Vector3.Distance(Target.transform.position, transform.position)) <= attackDistance;
            Func <bool> TargetOutofRange() => () => Target != null && Mathf.Abs(Vector3.Distance(Target.transform.position, transform.position)) > attackDistance;
            Func <bool> ReadyToDie() => () => enemyHealth.GetCurrentHealth() <= 0;

            InvokeRepeating(nameof(UpdatePath), 0f, .5f);
        }
Example #7
0
        private void OnLandingFxSuccess(object asset, object cookie)
        {
            GameObject    landingEffect = this.IntantiateEffect(asset);
            SpecialAttack specialAttack = (SpecialAttack)cookie;

            specialAttack.EffectAnimator.LandingEffect = landingEffect;
        }
Example #8
0
 // Start is called before the first frame update
 void Start()
 {
     target  = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     anim    = GetComponent <Animator>();
     ogre_rb = GetComponent <Rigidbody2D>();
     sA      = GameObject.FindGameObjectWithTag("Special").GetComponent <SpecialAttack>();
 }
        private List <Object> AttackSpecialSuccess(string catcheurPseudo, SpecialAttack specialAtk, int[] rates)
        {
            List <Object> whatToDo = new List <Object>();

            int previousSuccessRate = 0;
            int random = MatchManager.instance.dice.Next(1, 101);
            int Count  = 1;

            foreach (int successRate in rates)
            {
                if (random > previousSuccessRate && random <= successRate + previousSuccessRate)
                {
                    Console.WriteLine($"L'attaque spéciale [{specialAtk} P{Count}] de {catcheurPseudo} a réussi !");
                    whatToDo.Add(true);
                    whatToDo.Add($"P{Count}");
                    return(whatToDo);
                }
                else
                {
                    if (Count == rates.Length)
                    {
                        Console.WriteLine($"L'attaque spéciale [{specialAtk}] de {catcheurPseudo} a échoué...");
                        whatToDo.Add(false);
                        whatToDo.Add("");
                        return(whatToDo);
                    }
                    previousSuccessRate = successRate;
                }
                Count++;
            }
            return(whatToDo);
        }
Example #10
0
        private void OnTakeOffFxSuccess(object asset, object cookie)
        {
            GameObject    takeOffEffect = this.IntantiateEffect(asset);
            SpecialAttack specialAttack = (SpecialAttack)cookie;

            specialAttack.EffectAnimator.TakeOffEffect = takeOffEffect;
        }
Example #11
0
 public void Setup(SpecialAttack specialAttack)
 {
     ability = specialAttack;
     transform.Find("Icon").GetComponent <Image>().sprite = ability.icon;
     transform.Find("Title").GetComponent <Text>().text   = ability.title;
     cooldown = transform.Find("Cooldown").GetComponent <Image>();
 }
Example #12
0
        private void AddSpecialAttackDamageBuff(SpecialAttack specialAttack, WarBuffVO warBuffVO)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            BuffTypeVO           buffVO = staticDataController.Get <BuffTypeVO>(warBuffVO.TroopBuffUid);

            specialAttack.AddAppliedBuff(buffVO, BuffVisualPriority.SquadWars);
        }
Example #13
0
        private void DestroyFromCookie(uint id, object cookie)
        {
            SpecialAttack specialAttack = (SpecialAttack)cookie;

            this.Destroy(specialAttack);
            this.specialAttacksExpended.Remove(specialAttack);
            this.viewTimers.Remove(id);
        }
    // Start is called before the first frame update
    void Start()
    {
        target           = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        sA               = GameObject.FindGameObjectWithTag("Special").GetComponent <SpecialAttack>();
        timeBetweenShots = startTimeBetweenShots;

        anim = GetComponent <Animator>();
    }
Example #15
0
        private void OnDropshipTakeOffTimer(uint id, object cookie)
        {
            SpecialAttack specialAttack = (SpecialAttack)cookie;
            GameObject    takeOffEffect = specialAttack.EffectAnimator.TakeOffEffect;

            this.PlayParticle(takeOffEffect);
            Service.EventManager.SendEvent(EventId.SpecialAttackDropshipFlyingAway, specialAttack);
        }
Example #16
0
        private void OnAssetSuccess(object asset, object cookie)
        {
            SpecialAttack specialAttack = (SpecialAttack)cookie;

            specialAttack.StarshipGameObject = (asset as GameObject);
            this.EnsureShadowAnimator(specialAttack, specialAttack.StarshipGameObject);
            specialAttack.EffectAnimator = new LandingTakeOffEffectAnim(specialAttack.StarshipGameObject);
            AssetManager assetManager = Service.AssetManager;

            if (this.DoesSpecialAttackNeedTakeoffAndLanding(specialAttack))
            {
                assetManager.Load(ref specialAttack.EffectAnimator.LandingHandle, "fx_landing_lrg", new AssetSuccessDelegate(this.OnLandingFxSuccess), null, specialAttack);
                assetManager.Load(ref specialAttack.EffectAnimator.TakeoffHandle, "fx_takeoff_lrg", new AssetSuccessDelegate(this.OnTakeOffFxSuccess), null, specialAttack);
            }
            if (specialAttack.StarshipGameObject == null)
            {
                return;
            }
            if (!string.IsNullOrEmpty(specialAttack.VO.DropoffAttachedAssetName))
            {
                assetManager.Load(ref specialAttack.AttachmentHandle, specialAttack.VO.DropoffAttachedAssetName, new AssetSuccessDelegate(this.OnAttachmentLoadedSuccess), null, specialAttack);
            }
            Rand            rand            = Service.Rand;
            float           angle           = (float)(rand.SimRange(-specialAttack.VO.AngleOfRollVariance, specialAttack.VO.AngleOfRollVariance + 1) + specialAttack.VO.AngleOfRoll);
            AttackFormation attackFormation = specialAttack.VO.AttackFormation;
            float           angle2;

            if (attackFormation != AttackFormation.Semicircle)
            {
                angle2 = (float)(rand.SimRange(-specialAttack.VO.AngleOfAttackVariance, specialAttack.VO.AngleOfAttackVariance + 1) + specialAttack.VO.AngleOfAttack);
            }
            else
            {
                int num = Convert.ToInt32((long)((ulong)specialAttack.AttackerIndex * (ulong)((long)(2 * specialAttack.VO.AngleOfAttackVariance) / (long)((ulong)specialAttack.VO.NumberOfAttackers))));
                angle2 = (float)(specialAttack.VO.AngleOfAttack - specialAttack.VO.AngleOfAttackVariance + num);
            }
            specialAttack.StarshipGameObject.transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward) * Quaternion.AngleAxis(angle2, Vector3.up);
            specialAttack.StarshipGameObject.transform.position = new Vector3(specialAttack.TargetWorldPos.x, specialAttack.StarshipGameObject.transform.position.y, specialAttack.TargetWorldPos.z);
            AssetMeshDataMonoBehaviour component = specialAttack.StarshipGameObject.GetComponent <AssetMeshDataMonoBehaviour>();

            if (component != null && component.GunLocatorGameObjects != null && component.GunLocatorGameObjects.Count > 0)
            {
                specialAttack.GunLocators = component.GunLocatorGameObjects;
            }
            else
            {
                Service.Logger.ErrorFormat("SpecialAttack gun locator game objects are not set in meta: {0}", new object[]
                {
                    specialAttack.VO.Uid
                });
                specialAttack.GunLocators = new List <GameObject>
                {
                    specialAttack.StarshipGameObject
                };
            }
            this.UpdateSpeed(specialAttack);
            specialAttack.StarshipGameObject.GetComponent <Animation>().Play("Fly");
        }
Example #17
0
 private void EnsureShadowAnimator(SpecialAttack specialAttack, GameObject gameObject)
 {
     if (specialAttack.ShadowAnimator == null)
     {
         specialAttack.ShadowAnimator = new ShadowAnim(gameObject);
         return;
     }
     specialAttack.ShadowAnimator.EnsureShadowAnimSetup(gameObject);
 }
Example #18
0
        public void AddSpecial(SpecialAttacks id)
        {
            SpecialAttack s = GetSpecialAttack(id);

            if (s != null)
            {
                this.Specials.Add(s);
            }
        }
Example #19
0
        private void OnSpawnDropshipTroopsTimer(uint id, object cookie)
        {
            SpecialAttack specialAttack = cookie as SpecialAttack;
            IntPosition   spawnPosition = Units.WorldToBoardIntPosition(specialAttack.TargetWorldPos);

            if (Service.GameStateMachine.CurrentState is BattlePlayState || Service.GameStateMachine.CurrentState is BattlePlaybackState)
            {
                this.DeployDropShipTroops(spawnPosition, specialAttack.VO.LinkedUnit, specialAttack.VO.UnitCount, specialAttack.TeamType);
            }
        }
Example #20
0
        private bool DoesSpecialAttackNeedTakeoffAndLanding(SpecialAttack specialAttack)
        {
            bool result = false;

            if (specialAttack.VO != null && (specialAttack.VO.IsDropship || specialAttack.VO.HasDropoff))
            {
                result = true;
            }
            return(result);
        }
Example #21
0
 public void Cast(Unit target, SpecialAttack specialAttack)
 {
     if (!isBusy() && specialAttack.IsUsableNow(target, this))
     {
         state = State.Casting;
         currentSpecialAttack = specialAttack;
         specialAttack.PreAttackAction(target, this);
         castTimer  = specialAttack.attackPeriod;
         castTarget = target;
     }
 }
Example #22
0
 void Start()
 {
     knightCurrentHealth  = knightMaxHealth;
     knightCurrentStamina = knightMaxStamina;
     knightCurrentMana    = knightMaxMana;
     sprint    = dayn1.GetComponent <wasd>();
     skillToss = dayn1.GetComponent <SpecialAttack>();
     hpBar.SetMaxValue(knightMaxHealth);
     mpBar.SetMaxValue(knightMaxMana);
     spBar.SetMaxValue(knightMaxStamina);
 }
Example #23
0
        private void OnDetachableGameObjectImpact(SpecialAttack attack)
        {
            attack.UpdateDetachableShadowAnimator(SpecialAttackDetachableObjectState.OnGround);
            if (attack.StarshipDetachableGameObject.transform.parent != null)
            {
                attack.StarshipDetachableGameObject.transform.parent = null;
            }
            Vector3 position = attack.StarshipDetachableGameObject.transform.position;

            attack.StarshipDetachableGameObject.transform.position = Vector3.Scale(position, Vector3.one - Vector3.up);
        }
Example #24
0
 public void UpdateSpecialAttacks()
 {
     while (this.specialAttacksDeployed.Count > 0)
     {
         SpecialAttack specialAttack = this.specialAttacksDeployed.Dequeue();
         this.specialAttacksExpended.Add(specialAttack);
         this.numShipsScheduled++;
         uint spawnDelay = specialAttack.SpawnDelay;
         this.simTimers.Add(Service.SimTimerManager.CreateSimTimer(spawnDelay, false, new TimerDelegate(this.OnDelayedLoad), specialAttack));
     }
 }
Example #25
0
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id == EventId.SpecialAttackSpawned && base.IsEventValidForBattleObjective())
     {
         SpecialAttack specialAttack = (SpecialAttack)cookie;
         if (specialAttack.TeamType == TeamType.Attacker)
         {
             this.parent.Progress(this, 1);
         }
     }
     return(EatResponse.NotEaten);
 }
Example #26
0
        private void OnAttachmentLoadedSuccess(object asset, object cookie)
        {
            GameObject    gameObject    = asset as GameObject;
            SpecialAttack specialAttack = (SpecialAttack)cookie;

            specialAttack.StarshipDetachableGameObject = gameObject;
            specialAttack.SetupDetachableShadowAnimator();
            Transform attachTransform = GameUtils.FindAssetMetaDataTransform(specialAttack.StarshipGameObject, "locator_attach");

            this.AttachGameObject(attachTransform, gameObject, true);
            specialAttack.UpdateDetachableShadowAnimator(SpecialAttackDetachableObjectState.Attached);
        }
        public void HandleSpecialAttackDeployedEvent(object cookie)
        {
            SpecialAttack specialAttack = (SpecialAttack)cookie;
            SpecialAttackDeployedAction specialAttackDeployedAction = new SpecialAttackDeployedAction();

            specialAttackDeployedAction.Time            = this.GetActionTime();
            specialAttackDeployedAction.SpecialAttackId = specialAttack.VO.Uid;
            specialAttackDeployedAction.BoardX          = specialAttack.TargetBoardX;
            specialAttackDeployedAction.BoardZ          = specialAttack.TargetBoardZ;
            specialAttackDeployedAction.TeamType        = specialAttack.TeamType;
            this.battleRecord.Add(specialAttackDeployedAction);
        }
Example #28
0
        private void OnDelayedLoad(uint id, object cookie)
        {
            this.numShipsScheduled--;
            SpecialAttack specialAttack = cookie as SpecialAttack;

            if (specialAttack == null)
            {
                return;
            }
            string            assetName      = specialAttack.VO.AssetName;
            WorldPreloadAsset preloadedAsset = Service.WorldPreloader.GetPreloadedAsset(assetName);

            if (preloadedAsset == null)
            {
                Service.AssetManager.Load(ref specialAttack.Handle, assetName, new AssetSuccessDelegate(this.OnAssetSuccess), null, specialAttack);
            }
            else
            {
                specialAttack.Handle = preloadedAsset.Handle;
                if (preloadedAsset.GameObj != null)
                {
                    this.OnAssetSuccess(preloadedAsset.GameObj, specialAttack);
                }
            }
            uint num = specialAttack.VO.AnimationDelay;

            if (specialAttack.VO.IsDropship || specialAttack.VO.HasDropoff)
            {
                this.numHoveringInbound++;
                this.EnsureShadowAnimator(specialAttack, null);
                specialAttack.ShadowAnimator.PlayShadowAnim(true);
                Service.ViewTimerManager.CreateViewTimer(3f, false, new TimerDelegate(this.OnDropshipLandedTimer), specialAttack);
                Service.ViewTimerManager.CreateViewTimer(3u * num, false, new TimerDelegate(this.UnregisterShadowAnimator), specialAttack.ShadowAnimator);
            }
            if (specialAttack.VO.IsDropship)
            {
                this.simTimers.Add(Service.SimTimerManager.CreateSimTimer(num, false, new TimerDelegate(this.OnSpawnDropshipTroopsTimer), specialAttack));
            }
            else
            {
                uint shotCount = specialAttack.VO.ShotCount;
                int  num2      = 0;
                while ((long)num2 < (long)((ulong)shotCount))
                {
                    this.simTimers.Add(Service.SimTimerManager.CreateSimTimer(num, false, new TimerDelegate(this.SpawnProjectile), specialAttack));
                    this.numAttackScheduled++;
                    num += specialAttack.VO.ShotDelay;
                    num2++;
                }
            }
            this.viewTimers.Add(Service.ViewTimerManager.CreateViewTimer(specialAttack.VO.DestroyDelay, false, new TimerDelegate(this.DestroyFromCookie), specialAttack));
        }
Example #29
0
        private void FillSpecialsList()
        {
            this.Specials = new ArrayList();

            foreach (SpecialAttacks sid in this.tmpSpecialsList)
            {
                SpecialAttack s = GetSpecialAttack(sid);
                if (s != null)
                {
                    this.Specials.Add(s);
                }
            }
        }
Example #30
0
    void Awake()
    {
        movementScript       = GetComponent <PlayerMovement>();
        healthScript         = GetComponent <PlayerHealth>();
        shootingScript       = GetComponent <Shooting>();
        speacialAttackScript = GetComponent <SpecialAttack>();


        movementScript.speed = hSpeed;

        initilizeShooting();
        initilizeHealth();
    }
Example #31
0
 //
 public Stats()
 {
     _name = "Placeholder";
     _class = "Placeholder";
     _health = 1;
     _defence = 1;
     _resistance = 1;
     _damage = 1;
     _magicDamage = 1;
     _level = 1;
     _exp = 1;
     _spAttack = null;
     _id = "Placeholder";
     for(int i = 0; i < 5; i++)
     {
         _statGrowth[i] = 1;
     }
 }
Example #32
0
 public void SetCharacter(string characterName)
 {
     CharDBInfo characterInfo = CharDB.GetCharacterDataBaseInfo (characterName);
     _playerTransformer.transformStats = characterInfo.transformationStatsBuff;
     _specialAttack = gameObject.GetComponent<SpecialAttack> ();
 }
        private void BTN_SaveAttack_Click(object sender, EventArgs e)
        {
            using (XNAUtils utils = new XNAUtils())
            {
                if (LBL_ATK_Name.Text == LIST_SpecialAttacks.SelectedItem.ToString() || !ContainsSameName(LIST_SpecialAttacks, LBL_ATK_Name.Text))
                {
                    SpecialAttack atk = new SpecialAttack();
                    pIcon icon = new pIcon(utils.ConvertToTexture(PN_Attaque.BackgroundImage), LBL_ATK_Name.Text);
                    atk.AtkIcon = icon;
                    atk.AtkType = (AttackType)DDL_ATK_Type.SelectedItem;
                    atk.DamageRatio = (float)NUM_ATK_Ratio.Value;
                    atk.Name = LBL_ATK_Name.Text;
                    atk.Radius = (int)NUM_ATK_Radius.Value;
                    atk.AnimTarget = (Animation)DDL_ATK_AnimationTarget.SelectedItem;
                    atk.AnimSelf = (Animation)DDL_ATK_AnimationSelf.SelectedItem;
                    atk.Target = (TargetType)DDL_Cible.SelectedItem;

                    LIST_SpecialAttacks.Items[LIST_SpecialAttacks.SelectedIndex] = atk;
                }
                else
                    GenerateSaveWarningBox("attaque spéciale", LBL_ATK_Name.Text);
            }
        }
Example #34
0
 //
 public int TakeDamage(SpecialAttack sp)
 {
     int damage = 0;
     if (sp.Contains ("melee"))
     {
         damage = (sp._damage - _defence);
         if (damage > 0)
         {
             _currentHealth -= damage;
         }
         else
         {
             damage = 0;
         }
     }
     else if (sp.Contains ("magic"))
     {
         damage = (sp._damage - _resistance);
         _currentHealth -= damage;
     }
     return damage;
 }
Example #35
0
 //
 public void setStats(Stats x)
 {
     _name = x._name;
     _class = x._class;
     _health = x._health;
     _defence = x._defence;
     _resistance = x._resistance;
     _damage = x._damage;
     _magicDamage = x._magicDamage;
     _level = x._level;
     _exp = x._exp;
     _spAttack = x._spAttack;
     _id = x._id;
     for(int i = 0; i < 5; i++)
     {
         _statGrowth[i] = x._statGrowth[i];
     }
 }
Example #36
0
 //
 public void SetSpecial(string name)
 {
     Object temp = Instantiate((GameObject)Resources.Load ("Sepcials/" + name));
     GameObject special = GameObject.Find (temp.name);
     special.transform.parent = this.gameObject.transform;
     _spAttack = special.GetComponent<SpecialAttack> ();
     special.name = _spAttack._name;
 }
        private void CheckCombos(Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven, SpecialAttack s)
        {
            if(s == null) return;

            foreach(ActiveCombo c in Combos)
            {
                if(c != null && c.Combo != null && c.Combo.AttackSequence != null && c.PositionInSequence < c.Combo.AttackSequence.Length)
                {
                    if(c.Combo.AttackSequence[c.PositionInSequence] == s.AttackID)
                    {
                        if(++c.PositionInSequence >= c.Combo.AttackSequence.Length)
                        {
                            // combo is complete so execute it
                            DoComboAttack(attacker, defender, weapon, damageGiven, c.Combo);

                            // and reset it
                            c.PositionInSequence = 0;
                        }
                    } else
                    {
                        // out of sequence so reset the combo
                        c.PositionInSequence = 0;
                    }
                }
            }
        }
        public override void OnWeaponHit(Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven)
        {
            if(attacker == null || defender == null || weapon == null || m_SelectedAttack == null) return;

            if(!CheckRequirements(attacker,  m_SelectedAttack)) return;

            // take the requirements
            if(attacker.Backpack != null && m_SelectedAttack.Reagents != null && m_SelectedAttack.Quantity != null)
            {
                attacker.Backpack.ConsumeTotal( m_SelectedAttack.Reagents, m_SelectedAttack.Quantity, true);
            }

            attacker.Mana -= m_SelectedAttack.ManaReq;
            attacker.Stam -= m_SelectedAttack.StamReq;
            attacker.Hits -= m_SelectedAttack.HitsReq;
            attacker.Karma -= m_SelectedAttack.KarmaReq;

            // apply the attack
            DoSpecialAttack( attacker, defender, weapon, damageGiven, m_SelectedAttack);

            if(m_SelectedAttack.KarmaReq > 0)
            {
                attacker.SendMessage("and lose a little karma.");
            }

            // after applying a special attack activate the specials timer for combo chaining
            DoComboTimer(attacker, m_SelectedAttack.ChainTime);

            // check all combos to see which have this attack as the next in sequence, and which might be complete
            CheckCombos(attacker, defender, weapon, damageGiven, m_SelectedAttack);

            // clear the selected attack
            m_SelectedAttack = null;

            // redisplay the gump
            attacker.SendGump(new CustomAttacksGump(attacker, this));
        }
        //
        // carry out the special attacks
        //
        // If you add a new attack, you must add the code here to define what it actually does when it hits
        //
        public void DoSpecialAttack(Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven, SpecialAttack special)
        {
            if(attacker == null || defender == null || weapon == null || special == null) return;

            attacker.SendMessage("you strike with {0}!", special.Name);

            // apply the special attack
            switch(special.AttackID)
            {
                case SpecialAttacks.TripleSlash:
                {
                    defender.Damage( weapon.MaxDamage*3, attacker );
                    break;
                }
                case SpecialAttacks.MindDrain:
                {
                    defender.Mana -= weapon.MaxDamage;
                    break;
                }
                case SpecialAttacks.VortexStrike:
                {
                    attacker.PlaySound( 0x217 );
                    BaseCreature m = new EnergyVortex();
                    m.Summoned = true;
                    m.SummonMaster = attacker;
                    m.Combatant = defender;
                    m.MoveToWorld(defender.Location, defender.Map);
                    break;
                }
                case SpecialAttacks.StamDrain:
                {
                    defender.Stam -= weapon.MaxDamage;
                    break;
                }
                case SpecialAttacks.PuffOfSmoke:
                {
                    attacker.Hidden = true;
                    break;
                }
                case SpecialAttacks.GiftOfHealth:
                {
                    attacker.FixedEffect( 0x376A, 9, 32 );
                    attacker.PlaySound( 0x202 );
                    attacker.Hits = attacker.HitsMax;
                    break;
                }
                case SpecialAttacks.ParalyzingFear:
                {
                    // lose target focus
                    defender.Combatant = null;
                    // flee
                    if(defender is BaseCreature)
                    {
                        ((BaseCreature)defender).BeginFlee(TimeSpan.FromSeconds(6));
                    }
                    // and become paralyzed
                    defender.Freeze( TimeSpan.FromSeconds(3) );
                    defender.FixedEffect( 0x376A, 9, 32 );
                    defender.PlaySound( 0x204 );
                    break;
                }
                default:
                    attacker.SendMessage("no effect");
                    break;
            }
        }
        public static bool CheckRequirements(Mobile from, SpecialAttack s)
        {
            if(from == null || s == null) return false;

            // test for str, dex, int requirements
            if(from.Str < s.StrReq)
            {
                from.SendMessage("Need {0} Str to perform {1}", s.StrReq, s.Name);
                return false;
            }
            if(from.Dex < s.DexReq)
            {
                from.SendMessage("Need {0} Dex to perform {1}", s.DexReq, s.Name);
                return false;
            }
            if(from.Int < s.IntReq)
            {
                from.SendMessage("Need {0} Int to perform {1}", s.IntReq, s.Name);
                return false;
            }

            // test for skill requirements
            if(s.Skills != null && s.MinSkillLevel != null)
            {
                if(from.Skills == null) return false;

                for(int i = 0; i < s.Skills.Length; i++)
                {
                    // and check level
                    if(i < s.MinSkillLevel.Length)
                    {
                        Skill skill =  from.Skills[s.Skills[i]];
                        if(skill != null && s.MinSkillLevel[i] > skill.Base)
                        {
                            from.SendMessage("Need {0} {1} to perform {2}", s.MinSkillLevel[i], s.Skills[i].ToString(), s.Name);
                            return false;
                        }
                    } else
                    {
                        from.SendMessage(33,"Error in skill level specification for {0}", s.Name);
                        return false;
                    }
                }
            }

            // test for mana, stam, and hits requirements
            if(from.Mana < s.ManaReq)
            {
                from.SendMessage("Need {0} Mana to perform {1}", s.ManaReq, s.Name);
                return false;
            }
            if(from.Stam < s.StamReq)
            {
                from.SendMessage("Need {0} Stamina to perform {1}", s.StamReq, s.Name);
                return false;
            }
            if(from.Hits < s.HitsReq)
            {
                // clear the selected attack
                from.SendMessage("Need {0} Hits to perform {1}", s.HitsReq, s.Name);
                return false;
            }

            // check for any reagents that are specified
            if(s.Reagents != null && s.Quantity != null)
            {
                if(from.Backpack == null) return false;

                for(int i = 0; i < s.Reagents.Length; i++)
                {
                    // go through each reagent
                    Item ret = from.Backpack.FindItemByType(s.Reagents[i], true);

                    // and check quantity
                    if(i < s.Quantity.Length)
                    {
                        if(ret == null || s.Quantity[i] > ret.Amount)
                        {
                            from.SendMessage("Need {1} {0} to perform {2}", s.Reagents[i].Name, s.Quantity[i], s.Name);
                            return false;
                        }
                    } else
                    {
                        from.SendMessage(33,"Error in quantity specification for {0}", s.Name);
                        return false;
                    }
                }
            }
            return true;
        }
            public CustomAttacksInfoGump( Mobile from, XmlCustomAttacks a, SpecialAttack s)
                : base(0,0)
            {
                m_attachment = a;
                m_special = s;

                // prepare the page
                AddPage( 0 );

                AddBackground( 0, 0, 400, 300, 5054 );
                AddAlphaRegion( 0, 0, 400, 300 );
                AddLabel( 20, 2, 55, String.Format("{0}",s.Name) );

                StringBuilder text = new StringBuilder();

                text.AppendFormat("\n{0}", s.Description );

                text.AppendFormat("\n\nMinimum Stats/Skills:" );
                if(s.StrReq > 0)
                {
                    text.AppendFormat("\n     {0} Str", s.StrReq );
                }
                if(s.DexReq > 0)
                {
                    text.AppendFormat("\n     {0} Dex", s.DexReq );
                }
                if(s.IntReq > 0)
                {
                    text.AppendFormat("\n     {0} Int", s.IntReq );
                }

                if(s.Skills != null)
                for(int i = 0;i < s.Skills.Length;i++)
                {
                    if(i < s.MinSkillLevel.Length)
                    {
                        text.AppendFormat("\n     {1} {0}", s.Skills[i].ToString(), s.MinSkillLevel[i]  );
                    } else
                    {
                        text.AppendFormat("\n     {1} {0}", s.Skills[i].ToString(), "???"  );
                    }
                }

                text.AppendFormat("\n\nConsumes:" );

                // generate the text requirements
                if(s.ManaReq > 0)
                {
                    text.AppendFormat("\n     {0} Mana", s.ManaReq );
                }
                if(s.StamReq > 0)
                {
                    text.AppendFormat("\n     {0} Stamina", s.StamReq );
                }
                if(s.HitsReq > 0)
                {
                    text.AppendFormat("\n     {0} Hits", s.HitsReq );
                }
                if(s.KarmaReq > 0)
                {
                    text.AppendFormat("\n     {0} Karma", s.KarmaReq );
                }

                if(s.Reagents != null)
                for(int i = 0;i < s.Reagents.Length;i++)
                {
                    if(i < s.Quantity.Length)
                    {
                        text.AppendFormat("\n     {1} {0}", s.Reagents[i].Name, s.Quantity[i]  );
                    } else
                    {
                        text.AppendFormat("\n     {1} {0}", s.Reagents[i].Name, "???"  );
                    }
                }

                AddHtml( 20,20, 360, 260, text.ToString(), true , true );
            }