Beispiel #1
0
	protected virtual void ExitPlacing(int numPlaced, AbilityType aType){
		AbilityObjectPlacedMessage objMess = new AbilityObjectPlacedMessage (numPlaced, aType);
		MessageCenter.Instance.Broadcast (objMess);
		AbilityStatusChangedMessage abMess = new AbilityStatusChangedMessage (false);
		MessageCenter.Instance.Broadcast (abMess);
		Destroy (this.gameObject);
	}
Beispiel #2
0
 public void ActionNotUsableWhenBlockedByStatusEffect(
     AbilityType abilityType,
     StatusEffect statusEffect)
 {
     battleAbility.Ability.AbilityType = abilityType;
     player.StatusEffects = new StatusEffect[] { statusEffect };
     VerifyActionNotUsable();
 }
Beispiel #3
0
 public void NotRecastableWhenOnRecast(AbilityType abilityType)
 {
     ability.AbilityType = abilityType;
     var memoryApi = new FakeMemoryAPI();
     memoryApi.Timer = new FakeTimer() { ActionRecast = 1 };
     var result = AbilityUtils.IsRecastable(memoryApi, ability);
     Assert.False(result);
 }
Beispiel #4
0
 public void IsRecastableWhenNotOnRecast(AbilityType abilityType)
 {
     ability.AbilityType = abilityType;
     var memoryApi = new FakeMemoryAPI();
     memoryApi.Timer = new FakeTimer();
     var result = AbilityUtils.IsRecastable(memoryApi, ability);
     Assert.True(result);
 }
 public Ability(int cooldown, int power, int moveSpeed, AbilityType type, float specialPower)
 {
     Cooldown = cooldown;
     AbilityPower = power;
     MoveSpeed = moveSpeed;
     SpecialPower = specialPower;
     Type = type;
 }
Beispiel #6
0
 /// <summary>
 /// 破盾
 /// </summary>
 /// <param name="general"></param>
 /// <param name="abilityType"></param>
 /// <returns></returns>
 public static bool AttackPoDun(CombatGeneral general, AbilityType abilityType)
 {
     SkillLvInfo skillLvInfo = CreateSkillLvInfo(general).Find(m => m.EffType == abilityType);
     if (skillLvInfo != null && RandomUtils.IsHit(skillLvInfo.Probability))
     {
         return true;
     }
     return false;
 }
Beispiel #7
0
 public Ability(int cooldown, int minPower, int maxPower, AbilityType abilityType, string textureName)
 {
     _cooldown = cooldown;
       _minPower = minPower;
       _maxPower = maxPower;
       TextureName = textureName;
       AbilityType = abilityType;
       _rand = new Random();
 }
 public BossMonster(int monsterMaxHealth, AbilityType? type = null)
     : base(monsterMaxHealth, type ?? AbilityType.Kamakaze)
 {
     Size = new Size((int)(Width * 1.5), (int)(Height * 1.5));
     Speed = MaxSpeed = MaxSpeed * 0.75;
     _gravityConstant = 400;
     FoeType = FoeType.Boss;
     SetMonsterSize();
 }
Beispiel #9
0
 public Skill(uint id, string name, uint ability, uint type, uint cost, uint aoe, uint range, float cooldown) {
     skillID = id;
     skillName = name;
     skillAbility = (AbilityType)ability;
     skillType = (SkillType)type;
     skillCost = cost;
     skillAoe = aoe;
     skillRange = range;
     skillCooldown = cooldown;
 }
Beispiel #10
0
        public Ability(AbilityType type, PhaseType phase, LimitType limit, string text)
        {
            if (text == null)
                throw new ArgumentNullException("text");

            this.type = type;
            this.phase = phase;
            this.limit = limit;
            this.text = text;
        }
Beispiel #11
0
 protected AbstractActionAbility(String name, int actionCost, AbilityType abilityType, TargetTypes targetTypes,
     DefaultTargetType defaultTarget, AnimationType animType , AbstractDamageBehaviour damageBehaviour)
     : base(name, actionCost, abilityType)
 {
     this.TargetType = targetTypes;
     this.DefaultTarget = defaultTarget;
     abilityType |= AbilityType.Action;
     //this.AnimationBehaviour = animBehaviour;
     this.DamageBehaviour = damageBehaviour;
     this.AnimationType = animType;
 }
Beispiel #12
0
 //constructor for instant, 1-time abilities, no DOTs
 public CharAbility(bool limitedByRange, List<AbilityStatsToAffect> characterStatsToEffect, AbilityType type, AbilityPosibleTargets possibleTargets, string name, int id, int range = 0)
 {
     this.limitedByRange = limitedByRange;
     this.characterStatsToEffect = characterStatsToEffect;
     this.type = type;
     this.name = name;
     this.id = id;
     this.range = range;
     this.overTime = false;
     this.overTimeRounds = 0;
     this.abilityPossibleTargets = possibleTargets;
 }
Beispiel #13
0
 /// <summary>
 ///     Represents all the types that are spells or casted.
 /// </summary>
 public static bool IsSpell(AbilityType abilityType)
 {
     switch (abilityType)
     {
         case AbilityType.Magic:
         case AbilityType.Ninjutsu:
         case AbilityType.Song:
         case AbilityType.Item:
             return true;
         default:
             return false;
     }
 }
Beispiel #14
0
 /// <summary>
 /// 法宝基础属性
 /// </summary>
 /// <param name="trumpInfo"></param>
 /// <param name="abilityType"></param>
 /// <returns></returns>
 public static short GetTrumpProperty(TrumpInfo trumpInfo, AbilityType abilityType)
 {
     short propertyNum = 0;
     if (trumpInfo.Property.Count > 0)
     {
         GeneralProperty property = trumpInfo.Property.Find(m => m.AbilityType == abilityType);
         if (property != null)
         {
             propertyNum = (short)property.AbilityValue;
         }
     }
     return propertyNum;
 }
Beispiel #15
0
        /// <summary>
        ///     Represents all the types that are not spells or casted.
        /// </summary>
        public static bool IsAbility(AbilityType abilityType)
        {
            switch (abilityType)
            {
                case AbilityType.Weaponskill:
                case AbilityType.Range:
                case AbilityType.Jobability:
                case AbilityType.Pet:
                case AbilityType.Monsterskill:
                    return true;

                default:
                    return false;
            }
        }
 public Monster(int monsterMaxHealth, AbilityType abilityType)
 {
     Velocity = new Vector(GetRandomVDelta() * 40, GetRandomVDelta() * 40);
     Size = new Size(Width, Height);
     Id = _id++;
     Health = MaxHealth = GetMonsterMaxHealth(monsterMaxHealth, abilityType);
     Speed = MaxSpeed = GetMaxSpeed(abilityType);
     Generation = 1;
     CreateAbilities();
     AbilityType = abilityType;
     Ability = AbilitiesDictionary[AbilityType];
     SetOnDeathAbilities();
     SetOnHitAbilities();
     SetMovementTypes();
     SetMonsterSize();
 }
Beispiel #17
0
        protected override object this[string index]
        {
            get
            {
                #region
                switch (index)
                {
                case "ItemID": return(ItemID);

                case "AttributeID": return(AttributeID);

                case "BaseNum": return(BaseNum);

                case "IncreaseNum": return(IncreaseNum);

                default: throw new ArgumentException(string.Format("ItemEquAttrInfo index[{0}] isn't exist.", index));
                }
                #endregion
            }
            set
            {
                #region
                switch (index)
                {
                case "ItemID":
                    _ItemID = value.ToInt();
                    break;

                case "AttributeID":
                    _AttributeID = value.ToEnum <AbilityType>();
                    break;

                case "BaseNum":
                    _BaseNum = value.ToInt();
                    break;

                case "IncreaseNum":
                    _IncreaseNum = value.ToInt();
                    break;

                default: throw new ArgumentException(string.Format("ItemEquAttrInfo index[{0}] isn't exist.", index));
                }
                #endregion
            }
        }
        //demo howe to pass an enum to a method and access inside the method
        public void ApplyDamage(AbilityType type, int damage)
        {
            //we can access using enum name and (.) operator to use in an if() or a switch() statement
            if (type == AbilityType.Water)
            {
                Console.WriteLine("water ability does X damage");
            }

            switch (type)
            {
            case AbilityType.Fire:
                Console.WriteLine("water ability does X damage");
                break;

            default:
                break;
            }
        }
Beispiel #19
0
    public void GoToAbilityBranch(GameObject nextPanel)
    {
        if (EventSystem.current.currentSelectedGameObject.name == attackButton.name)
        {
            abilityType = AbilityType.ATTACK;
        }
        else if (EventSystem.current.currentSelectedGameObject.name == defenseButton.name)
        {
            abilityType = AbilityType.DEFENSE;
        }
        else if (EventSystem.current.currentSelectedGameObject.name == rogueButton.name)
        {
            abilityType = AbilityType.SABOTAGE;
        }

        abilityBranchManager.SelectedAbilityBranch(abilityType);
        GoToNextPanel(nextPanel);
    }
 /// <summary>
 /// 种族构造函数
 /// </summary>
 /// <param name="name"></param>
 /// <param name="hea"></param>
 /// <param name="ppow"></param>
 /// <param name="pdef"></param>
 /// <param name="epow"></param>
 /// <param name="edef"></param>
 /// <param name="speed"></param>
 /// <param name="type1"></param>
 /// <param name="type2"></param>
 /// <param name="ability1"></param>
 /// <param name="ability2"></param>
 /// <param name="ability3"></param>
 public Race(int raceid, string name, int hea, int ppow, int pdef, int epow, int edef, int speed,
             PokemonType type1, PokemonType type2, AbilityType ability1, AbilityType ability2, AbilityType ability3)
 {
     this.raceid       = raceid;
     sname             = name;
     health            = hea;
     phyPower          = ppow;
     phyDefence        = pdef;
     energyPower       = epow;
     energyDefence     = edef;
     this.speed        = speed;
     pokemonMainType   = type1;
     pokemonSecondType = type2;
     firstAbility      = ability1;
     secondAbility     = ability2;
     hideAbility       = ability3;
     //otherRace == new List<int>();
 }
Beispiel #21
0
        public void CallOnCdChanged(AbilityType abilityTypeType, float value)
        {
            if (!_abilitiesCd.ContainsKey(abilityTypeType))
            {
                _abilitiesCd[abilityTypeType] = 0.0f;
            }
            var oldValue = _abilitiesCd[abilityTypeType];

            _abilitiesCd[abilityTypeType] = Math.Max(oldValue + value, 0.0f);
            if (OnCdChanged != null)
            {
                OnCdChanged(abilityTypeType, 1.0f - _abilitiesCd[abilityTypeType] / GetCd(abilityTypeType));
            }
            if (oldValue > 0.0f && _abilitiesCd[abilityTypeType] == 0.0f)
            {
                CallOnAbilityCdEnd(abilityTypeType);
            }
        }
Beispiel #22
0
        /// <summary> 能力値を取得する </summary>
        /// <param name="ability">能力種類</param>
        /// <returns>能力値</returns>
        public override int GetAbility(AbilityType ability)
        {
            switch (ability)
            {
            case AbilityType.STR:
                return(GetBattleStatus(BattleStatusType.STR));

            case AbilityType.DEX:
                return(GetBattleStatus(BattleStatusType.DEX));

            case AbilityType.POW:
                return(GetBattleStatus(BattleStatusType.POW));

            case AbilityType.INT:
                return(GetBattleStatus(BattleStatusType.INT));
            }
            throw new ArgumentOutOfRangeException();
        }
        private void ToggleSkill(AbilityType type, int buttonIndex)
        {
            if (_characterIndex == -1)
            {
                return;
            }

            Ability skill = null;

            switch (type)
            {
            case AbilityType.Skill:
                skill = _skills[buttonIndex];
                break;

            case AbilityType.Special:
                skill = _specials[buttonIndex];
                break;

            case AbilityType.WhiteMagic:
                skill = _wMagic[buttonIndex];
                break;

            case AbilityType.BlackMagic:
                skill = _bMagic[buttonIndex];
                break;

            default:
                return;
            }

            var byteIndex = skill.BitOffset / 8;
            var bitIndex  = skill.BitOffset % 8;
            var offset    = Offsets.GetOffset(OffsetType.PartyStatsBase) + 0x94 * _characterIndex +
                            (int)PartyStatOffset.SkillFlags;
            var skillBytes =
                MemoryReader.ReadBytes(offset, 0x0C);

            var newByte = BitHelper.ToggleBit(skillBytes[byteIndex], bitIndex);

            skillBytes[byteIndex] = newByte;

            MemoryReader.WriteBytes(offset, skillBytes);
        }
Beispiel #24
0
    public static bool DidTargetPhase(Actor target, AbilityType abilityType)
    {
        if (target.Data.AttackPhasing > 0 && abilityType == AbilityType.ATTACK)
        {
            if (target.Data.AttackPhasing == 100 || UnityEngine.Random.Range(0, 100) < target.Data.AttackPhasing)
            {
                return(true);
            }
        }
        else if (target.Data.SpellPhasing > 0 && abilityType == AbilityType.SPELL)
        {
            if (target.Data.SpellPhasing == 100 || UnityEngine.Random.Range(0, 100) < target.Data.SpellPhasing)
            {
                return(true);
            }
        }

        return(false);
    }
Beispiel #25
0
 public SkillAttribute(
     SkillCategoryType category,
     string name,
     int maxRank,
     bool isActive,
     string description,
     bool contributesToSkillCap,
     AbilityType primaryStat,
     AbilityType secondaryStat)
 {
     Category              = category;
     Name                  = name;
     MaxRank               = maxRank;
     IsActive              = isActive;
     Description           = description;
     ContributesToSkillCap = contributesToSkillCap;
     PrimaryStat           = primaryStat;
     SecondaryStat         = secondaryStat;
 }
    IEnumerator UseAbility()
    {
        if (ability == AbilityType.Speed)
        {
            forwardSpeed = 200;
            yield return(new WaitForSeconds(5.0f));

            forwardSpeed = 100;
        }
        if (ability == AbilityType.Invunrable)
        {
            damageScale = 0;
            yield return(new WaitForSeconds(5.0f));

            damageScale = 1;
        }
        ability = AbilityType.None;
        yield return(null);
    }
Beispiel #27
0
    // Set secondary image which is overlayed over the specified ability slot and set how it should be animated
    /// <summary>
    /// 0 = no behaviour, 1 = rotate clockwise, 2 = rotate counterclockwise slowly
    /// </summary>
    /// <param name="index"></param>
    /// <param name="ability"></param>
    /// <param name="animState"></param>
    public void SetAbilityIconB(int index, AbilityType ability, int animState)
    {
        // If it is any state which should not rotate, reset rotation
        if (animState == 0)
        {
            ResetIconBTransform(index);
        }

        if (index == 0)
        {
            ability1IconB.sprite = AbilityUtils.GetDisplayIconB(ability);
            ability1IconBstate   = animState;
        }
        else
        {
            ability2IconB.sprite = AbilityUtils.GetDisplayIconB(ability);
            ability2IconBstate   = animState;
        }
    }
Beispiel #28
0
    public Card(string name, string logoPath, int attack, int defense, int manacost, AbilityType abilityType = 0)
    {
        Name      = name;
        Logo      = Resources.Load <Sprite>(logoPath);
        Attack    = attack;
        Defense   = defense;
        Manacost  = manacost;
        CanAttack = false;
        IsPlaced  = false;

        Abilities = new List <AbilityType>();

        if (abilityType != 0)
        {
            Abilities.Add(abilityType);
        }

        TimesDealedDamage = 0;
    }
        private AbilityData(byte[] data)
        {
            byte b2 = data[2];
            byte b11 = data[11];
            byte b12 = data[12];

            data.Decode();

            data[2] = b2;
            data[11] = b11;
            data[12] = b12;

            this.id = data[0] | data[1] << 8;
            this.type = (AbilityType)data[2];
            this.mpcost = data[6] | data[7] << 8;
            this.timerid = data[8] | data[9] << 8;
            this.validtargets = (ValidTargets)(data[10] | data[11] << 8);
            this.tpcost = data[12];
        }
Beispiel #30
0
    public Ability(AbilityType abilityType)
    {
        this.abilityType = abilityType;
        switch (abilityType)
        {
        case AbilityType.QuickGun:
            maxChargesAvailable        = 20;
            maxChargeReplenishCooldown = 0.5f;
            abilityEndLag = 0.1f;
            abilityIcon   = Resources.Load <Sprite>("Sprites/quickGunAbilityIcon") as Sprite;
            break;

        case AbilityType.ParallelGun:
            maxChargesAvailable        = 6;
            maxChargeReplenishCooldown = 2.5f;
            abilityEndLag = 1f;
            abilityIcon   = Resources.Load <Sprite>("Sprites/parallelGunAbilityIcon") as Sprite;
            break;

        case AbilityType.XGun:
            maxChargesAvailable        = 3;
            maxChargeReplenishCooldown = 2f;
            abilityEndLag = 0.9f;
            abilityIcon   = Resources.Load <Sprite>("Sprites/xGunAbilityIcon") as Sprite;
            break;

        case AbilityType.DoubleShotGun:
            maxChargesAvailable        = 4;
            maxChargeReplenishCooldown = 3f;
            abilityEndLag = 1f;
            abilityIcon   = Resources.Load <Sprite>("Sprites/doubleShotGunAbilityIcon") as Sprite;
            break;

        case AbilityType.Shrink:
            maxChargesAvailable        = 5;
            maxChargeReplenishCooldown = 3;
            abilityIcon = Resources.Load <Sprite>("Sprites/shrinkAbilityIcon") as Sprite;
            break;
            //todo: add more ability constructors
        }
        chargesAvailable        = maxChargesAvailable;
        chargeReplenishCooldown = maxChargeReplenishCooldown;
    }
        /// <summary>
        /// Decides which ability to use based on the input context and activates it
        /// </summary>
        /// <param name="context">The input callback context</param>
        /// <param name="args">Any additional arguments to give to the ability.
        public void BufferSpecialAbility(InputAction.CallbackContext context, params object[] args)
        {
            //Ignore player input if they aren't in a state that can attack
            if (_playerState != "Idle" && _playerState != "Attacking")
            {
                return;
            }

            AbilityType abilityType = AbilityType.SPECIAL;

            _attackDirection.x *= Mathf.Round(transform.forward.x);

            //Assign the arguments for the ability
            args[1] = _attackDirection;

            //Use a normal ability if it was not held long enough
            _bufferedAction  = new BufferedInput(action => UseAbility(abilityType, args), condition => { _abilityBuffered = false; return(_moveset.GetCanUseAbility() && !_gridMovement.IsMoving); }, 0.2f);
            _abilityBuffered = true;
        }
Beispiel #32
0
        /// <summary>
        /// 好感度加成属性
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="generalID"></param>
        /// <param name="abilityType"></param>
        /// <returns></returns>
        public static int FeelEffectNum(string userID, int generalID, AbilityType abilityType)
        {
            int         effectNum = 0;
            UserGeneral general   = new PersonalCacheStruct <UserGeneral>().FindKey(userID, generalID);

            if (general != null)
            {
                FeelLvInfo lvInfo = new ShareCacheStruct <FeelLvInfo>().FindKey(general.FeelLv);
                if (lvInfo != null)
                {
                    GeneralProperty property = lvInfo.Property.Find(m => m.AbilityType.Equals(abilityType));
                    if (property != null)
                    {
                        effectNum = property.AbilityValue.ToInt();
                    }
                }
            }
            return(effectNum);
        }
        public void ResendGump(AbilityType abilityType)
        {
            if (Engine.Player == null)
            {
                return;
            }

            int twoHandSerial = Engine.Player.GetLayer(Layer.TwoHanded);

            Item twoHandItem = Engine.Items.GetItem(twoHandSerial);

            if (twoHandItem != null)
            {
                WeaponData wd =
                    (_weaponData ?? throw new InvalidOperationException()).FirstOrDefault(d =>
                                                                                          d.Graphic == twoHandItem.ID);

                if (wd != null)
                {
                    ResendGump(wd.Primary, wd.Secondary, abilityType);
                    return;
                }
            }

            int oneHandSerial = Engine.Player.GetLayer(Layer.OneHanded);

            Item oneHandItem = Engine.Items.GetItem(oneHandSerial);

            if (oneHandItem != null)
            {
                WeaponData wd =
                    (_weaponData ?? throw new InvalidOperationException()).FirstOrDefault(d =>
                                                                                          d.Graphic == oneHandItem.ID);

                if (wd != null)
                {
                    ResendGump(wd.Primary, wd.Secondary, abilityType);
                    return;
                }
            }

            ResendGump(5, 11, abilityType);
        }
Beispiel #34
0
        private void ChangeState(Button button, AbilityType abilityType)
        {
            var selectedAbilities = AbilitiesStorage.Instance.SelectedAbilities;

            AbilitiesStorage.Instance.ChangeState(abilityType);
            if (selectedAbilities.Contains(abilityType))
            {
                SetSelected(button, false);
            }
            else
            {
                if (selectedAbilities.Count >= 4)
                {
                    return;
                }

                SetSelected(button, true);
            }
        }
Beispiel #35
0
    public void EnableUlti()
    {
        // ulti can only be enabled if same ability in both hands
        Debug.Assert(equippedAbilities[(int)HackerHand.Left] == equippedAbilities[(int)HackerHand.Right]);

        if (oldAbility != AbilityType.None)
        {
            Debug.LogWarning("tried to call EnableUlti(), but is already enabled");
            return; // already enabled
        }

        // store current ability to select it again in DisableUlti
        oldAbility = equippedAbilities[(int)HackerHand.Left];

        // disable current abilities
        DisableEquippedAbility(HackerHand.Left);
        DisableEquippedAbility(HackerHand.Right);
        ultiActive = true;
    }
Beispiel #36
0
        public static void SetAbility(AbilityType ability, bool setTo = true)
        {
            if (setTo)
            {
                Data.SkillsFound.Add(ability);
            }
            else
            {
                Data.SkillsFound.Remove(ability);
            }

            InterOp.set_ability(ability, setTo);
            if (ability.Equip().HasValue)
            {
                InterOp.set_equipment(ability.Equip().Value, setTo);
            }

            TrackFileController.Write();
        }
Beispiel #37
0
        public Ability(AbilityType whichAbility)
        {
            type = whichAbility;
            switch (type)
            {
            case AbilityType.Lightning:
                m_cost                 = 5;
                m_cooldown             = 1;
                m_iconTextureAssetName = "lightning_icon";
                break;

            case AbilityType.CandyCane:
                m_cost                 = 5;
                m_cooldown             = 2;
                m_iconTextureAssetName = "CandyCaneIcon";
                break;

            case AbilityType.FreezeTime:
                m_cost                 = 10;//testing
                m_cooldown             = 5;
                m_iconTextureAssetName = "FreezeIcon";
                break;

            case AbilityType.GodAnimal:
                m_cost                 = 25;
                m_cooldown             = 6;
                m_iconTextureAssetName = "KevinMooseIcon";
                break;

            case AbilityType.SpiderFire:
                m_cost                 = 50;
                m_cooldown             = 8;
                m_iconTextureAssetName = "fire_icon";
                break;

            case AbilityType.Asteroid:
                m_cost                 = 120;
                m_cooldown             = 1;
                m_iconTextureAssetName = "meteor_icon";
                break;
            }
        }
Beispiel #38
0
    private void EquipAbility(HackerHand hand, AbilityType type)
    {
        int i = (int)hand;

        Debug.Assert(0 <= i && i <= 1);

        if (!allAbilityGOs[i].ContainsKey(type))
        {
            Debug.LogWarning("cannot equip ability type, no prefab configured: " + type);
            return;
        }

        // disable old equipment
        DisableEquippedAbility(hand);

        // enable new equipment
        EnableAbility(hand, type);

        UpdateActiveUltimate();
    }
Beispiel #39
0
        public static UpgradeType GetAbilityType(AbilityType type)
        {
            switch (type)
            {
            case AbilityType.BaseAttack:
                return(UpgradeType.AbilityAttackLevel);

            case AbilityType.UpgradeAttack:
                return(UpgradeType.AbilitySpecLevel);

            case AbilityType.Ultimate:
                return(UpgradeType.AbilityUltLevel);

            case AbilityType.Passive:
                return(UpgradeType.AbilityAttackLevel);

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Beispiel #40
0
        public static short maxFeelLv = ConfigEnvSet.GetInt("Gift.MaxFeelLv").ToShort(); //好感度最大等级

        #endregion Fields

        #region Methods

        /// <summary>
        /// 下一级属性数值
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="generalID"></param>
        /// <param name="abilityType"></param>
        /// <returns></returns>
        public static int FeelUpPropertyNum(string userID, int generalID, AbilityType abilityType)
        {
            int upPropertyNum = 0;
            UserGeneral userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(userID, generalID);
            if (userGeneral != null)
            {
                short maxFeelLv = ConfigEnvSet.GetInt("Gift.MaxFeelLv").ToShort();
                short feelLv = MathUtils.Addition(userGeneral.FeelLv, (short)1, maxFeelLv);
                FeelLvInfo upfeelLvInfo = new ConfigCacheSet<FeelLvInfo>().FindKey(feelLv);
                if (upfeelLvInfo != null && upfeelLvInfo.Property.Count > 0)
                {
                    GeneralProperty property = upfeelLvInfo.Property.Find(m => m.AbilityType == abilityType);
                    if (property != null)
                    {
                        upPropertyNum = property.AbilityValue.ToInt();
                    }
                }
            }
            return upPropertyNum;
        }
Beispiel #41
0
        public void PlayActivatable(Activatable act, Player Activator, AbilityType Mode, StackInstance si = null)
        {
            PlayersPassedInSuccession = 0;
            act.Activator             = Activator;
            if (act is SpecialAction)
            {
                act.Resolve(this, si);
                return;
            }
            if (act is Ability)
            {
                if (((Ability)act).IsManaAbility)
                {
                    act.Resolve(this, si);
                    return;
                }
            }

            MyExecutor.Do(new CommandPutOnStack(act.Host.ID, act.Host.Value(this).CurrentCharacteristics.IndexOfAbility(act, Mode), Mode));
        }
Beispiel #42
0
    public BattlePokemonData(Pokemon pokemon)
    {
        this.pokemon = pokemon;
        race = pokemon.PokeRace;
        basestats = pokemon.Basestats;
        IV = pokemon.IV;
        nature = pokemon.PokeNature;
        ShowAbility = pokemon.ShowAbility;
        Ename = pokemon.Ename;

        LHCoroutine.CoroutineManager.DoCoroutine(InitPokemonData());

        entity = Contexts.sharedInstance.game.CreateEntity();
        entity.AddBattlePokemonData(this);
        Action action = DefaultAction;
        entity.AddPokemonDataChangeEvent(action);

        ID = pokemon.GetInstanceID();
        Context[ID] = this;
    }
Beispiel #43
0
 public Ability(AbilityType t, string AbilityName, int Area, int range, int BaseDamage = 10)
 {
     if (t == AbilityType.MEN)
     {
         range = 3;
     }
     else
     {
         range = 1;
     }
     type              = t;
     this.AbilityName  = AbilityName;
     this.range        = range;
     this.Area         = Area;
     AbilityBaseDamage = BaseDamage;
     if (t == AbilityType.MEN)
     {
         range += 3;
     }
 }
Beispiel #44
0
        public Ability(string name, string key, string sprite_key, AbilityClass ability_class, AbilityType ability_type, float cooldown = 0f, int exp = 0, Skill skill = Skill.None, int required = 0)
        {
            Name        = name;
            Key         = key;
            Description = "empty";

            ExpCost       = exp;
            SkillUsed     = skill;
            SkillRequired = required;

            SpriteKey       = sprite_key;
            StatusSpriteKey = "";

            Class = ability_class;
            Type  = ability_type;

            Components    = new List <AbilityComponent>();
            Effects       = new List <AbilityEffect>();
            this.cooldown = cooldown;
        }
Beispiel #45
0
    public float GetMultiplier(AbilityType abilityType)
    {
        AnimationCurve curve    = AnimationCurve.Linear(0f, 0f, 1f, 1f);
        int            maxLevel = AbilityManager.Instance.abilityInfo[abilityType].maxLevel;

        switch (abilityType)
        {
        case AbilityType.ClickDamage:
            curve = clickDamageCurve;
            break;

        case AbilityType.TimeDamage:
            curve = timerDamageCurve;
            break;
        }

        float level = AbilityManager.Instance.AbilityLevel(abilityType);

        return(curve.Evaluate(level / (float)maxLevel));
    }
    public Card(string name, string logoPath, int attack, int helth, int cost, AbilityType abilityType = 0)
    {
        this.name   = name;
        logo        = Resources.Load <Sprite>(logoPath);
        this.attack = attack;
        this.helth  = helth;
        this.cost   = cost;
        canAttack   = false;
        isPlaced    = false;
        isSpell     = false;

        abilities = new List <AbilityType>();

        if (abilityType != 0)
        {
            abilities.Add(abilityType);
        }

        timesDealeDamage = 0;// для дабл атаки
    }
Beispiel #47
0
 // Use this for initialization
 public Ability(string name, string desc, AbilityType abilityType, bool useable, int mp, int speed, float dam, float hpup, bool haste, int dela, int atkdwn, int magakdwn, int defdwn, int magdefdwn, int agidwn, string anim, TargetType type)
 {
     this.abilityName        = name;
     this.abilityDesc        = desc;
     this.abilityType        = abilityType;
     this.useableOutOfCombat = useable;
     this.mpCost             = mp;
     this.applyHaste         = haste;
     this.speedRank          = speed;
     this.damage             = dam;
     this.heal                   = hpup;
     this.delay                  = dela;
     this.atkDown                = atkdwn;
     this.mgAtkDown              = magakdwn;
     this.defDown                = defdwn;
     this.magDefDown             = magdefdwn;
     this.agiDown                = agidwn;
     this.defaultAttackAnimation = anim;
     this.targetType             = type;
 }
        public bool ValidateTargetedAbilityUse(int useActorId, AbilityType abilityId, int targetActorId)
        {
            AbilityInfo info = AbilityInfo.InfoArray [(int)abilityId];

            // Only valid if it's targeted or self
            if (!(info.IsTargeted || info.IsSelf))
            {
                return(false);
            }
            // Not valid if the ability targets self and the use and target actor id are not the same
            if (info.IsSelf && useActorId != targetActorId)
            {
                return(false);
            }

            Actor useActor    = actors [useActorId];
            Actor targetActor = actors [targetActorId];

            if (!(info.Range == 0) && !GameUtility.CoordsWithinDistance(useActor.Position, targetActor.Position, info.Range + 5))
            {
                return(false);
            }

            // If the user and target are on the same and ally target isn't allowed it's invalid
            if (useActor.Team == targetActor.Team && !info.AllyTargetAllowed)
            {
                return(false);
            }
            // If the user and target anr't on the same time and enemy target itn't allowed it's invalid
            if (useActor.Team != targetActor.Team && !info.EnemyTargetAllowed)
            {
                return(false);
            }

            if (abilityId == AbilityType.Banish && targetActor.Stationary)
            {
                return(false);
            }

            return(useActor.UseAbility(abilityId));
        }
Beispiel #49
0
 public static decimal GetEffect(CombatGeneral general, AbilityType abilityType)
 {
     decimal effNum = 1;
     if (general.GeneralID != LanguageManager.GetLang().GameUserGeneralID)
     {
         return 0;
     }
     switch (abilityType)
     {
         case AbilityType.BaoJiJiaCheng:
             effNum = MathUtils.Addition(effNum, GetEffTypeNum(general, abilityType));
             break;
         case AbilityType.IsBaoJiReduce:
             effNum = MathUtils.Subtraction(effNum, GetEffTypeNum(general, abilityType));
             break;
         case AbilityType.Resurrect:
             effNum = GetEffTypeNum(general, abilityType);
             break;
         case AbilityType.AttackLife:
             effNum = GetEffTypeNum(general, abilityType);
             break;
         case AbilityType.Furious:
             effNum = LifeLowerTnumEffNum(general, abilityType);
             break;
         case AbilityType.NormalAttackPoFang:
             effNum = GetEffTypeNum(general, abilityType);
             break;
         case AbilityType.AttackPoDun:
             //effNum = GetEffTypeNum(general, abilityType);
             break;
         case AbilityType.FanShang:
             effNum = GetEffTypeNum(general, abilityType);
             break;
         default:
             return effNum;
     }
     return effNum;
 }
Beispiel #50
0
 public static bool getLockGun(AbilityType abil)
 {
     switch(abil)
     {
         case AbilityType.doubleThrottle:
             return false;
         case AbilityType.gas:
             return true;
         case AbilityType.halfRoundTurn:
             return false;
         case AbilityType.homingMissle:
             return true;
         case AbilityType.homingThorpede:
             return true;
         case AbilityType.mines:
             return false;
         case AbilityType.shield:
             return true;
         case AbilityType.turnAround:
             return false;
         default:
             return false;
     }
 }
Beispiel #51
0
        /// <summary>
        /// 装备封灵属性
        /// </summary>
        /// <param name="userItemID"></param>
        /// <param name="abilityType"></param>
        /// <returns></returns>
        private static SparePartProperty GetSparePartProperty(string userId, string userItemID, AbilityType abilityType)
        {
            double equSumNum = 0;
            var package = UserItemPackage.Get(userId);
            if (package == null)
            {
                return new SparePartProperty();
            }
            var userItemList = package.ItemPackage.FindAll(m => !m.IsRemove && m.UserItemID.Equals(userItemID));
            foreach (var userItem in userItemList)
            {
                if (userItem != null && (userItem.ItemStatus == ItemStatus.Sell || userItem.SoldDate > MathUtils.SqlMinDate))
                {
                    continue;
                }
                else if (userItem != null && userItem.ItemStatus != ItemStatus.Sell && userItem.SoldDate > MathUtils.SqlMinDate)
                {
                    userItem.SoldDate = MathUtils.SqlMinDate;
                    //package.Update();
                    continue;
                }

                //灵件配置
                var user = new GameDataCacheSet<GameUser>().FindKey(userId);
                if (user != null)
                {
                    var sparepartList = user.SparePartList.FindAll(m => m.UserItemID.Equals(userItemID));
                    foreach (var sparepart in sparepartList)
                    {
                        foreach (var property in sparepart.Propertys)
                        {
                            if (property.AbilityType == abilityType)
                            {
                                equSumNum = MathUtils.Addition(equSumNum, property.Num.ToDouble(), double.MaxValue);
                            }
                        }
                    }
                }
                return new SparePartProperty() { AbilityType = abilityType, Num = equSumNum };
            }
            return new SparePartProperty();
        }
Beispiel #52
0
 public Ability(int damage, int requiredLevel, AbilityType abilityType)
 {
     this.Damage = damage;
     this.requiredLevel = requiredLevel;
     this.abilityType = abilityType;
 }
Beispiel #53
0
 protected override object this[string index]
 {
     get
     {
         #region
         switch (index)
         {
             case "MagicID": return MagicID;
             case "MagicLv": return MagicLv;
             case "ShowMinLv": return ShowMinLv;
             case "EscalateMinLv": return EscalateMinLv;
             case "ExpNum": return ExpNum;
             case "ColdTime": return ColdTime;
             case "AbilityType": return AbilityType;
             case "EffectNum": return EffectNum;
             case "GridMaxNum": return GridMaxNum;
             case "GridRange": return GridRange;
             case "ReplacePostion": return ReplacePostion;
             default: throw new ArgumentException(string.Format("MagicLvInfo index[{0}] isn't exist.", index));
         }
         #endregion
     }
     set
     {
         #region
         switch (index)
         {
             case "MagicID":
                 _MagicID = value.ToInt();
                 break;
             case "MagicLv":
                 _MagicLv = value.ToShort();
                 break;
             case "ShowMinLv":
                 _ShowMinLv = value.ToShort();
                 break;
             case "EscalateMinLv":
                 _EscalateMinLv = value.ToShort();
                 break;
             case "ExpNum":
                 _ExpNum = value.ToInt();
                 break;
             case "ColdTime":
                 _ColdTime = value.ToInt();
                 break;
             case "AbilityType":
                 _AbilityType = value.ToEnum<AbilityType>();
                 break;
             case "EffectNum":
                 _EffectNum = value.ToDecimal();
                 break;
             case "GridMaxNum":
                 _GridMaxNum = value.ToShort();
                 break;
             case "GridRange":
                 _GridRange = value.ToNotNullString();
                 break;
             case "ReplacePostion":
                 _ReplacePostion = value.ToInt();
                 break;
             default: throw new ArgumentException(string.Format("MagicLvInfo index[{0}] isn't exist.", index));
         }
         #endregion
     }
 }
 //a * (1 - Math.pow(r, level)) / (1 - r)
 //points to get to level
 //with a = 20 , r = 1.08
 //
 //first 100%
 //second ~ 70%
 //third ~ 30%
 public PetLevel(AbilityType ability, Ability abilityType, int power, int level, Pet pet)
 {
     this.pet = pet;
     type = ability;
     Ability = abilityType;
     Level = level;
     Power = power;
 }
Beispiel #55
0
        private static void SetAbilityValue(CombatGeneral general, AbilityType abilityType, decimal effectNum)
        {
            switch (abilityType)
            {
                case AbilityType.ShengMing:
                    //注释原因:佣兵取最大生命时已经计算
                    //general.LifeNum += effectNum.ToInt();
                    break;
                case AbilityType.WuLiGongJi:
                    general.ExtraAttack.WuliNum += effectNum.ToInt();
                    break;
                case AbilityType.HunJiGongJi:
                    general.ExtraAttack.HunjiNum += effectNum.ToInt();
                    break;
                case AbilityType.MoFaGongJi:
                    general.ExtraAttack.MofaNum += effectNum.ToInt();
                    break;
                case AbilityType.WuLiFangYu:
                    general.ExtraDefense.WuliNum += effectNum.ToInt();
                    break;
                case AbilityType.HunJiFangYu:
                    general.ExtraDefense.HunjiNum += effectNum.ToInt();
                    break;
                case AbilityType.MoFaFangYu:
                    general.ExtraDefense.MofaNum += effectNum.ToInt();
                    break;
                case AbilityType.BaoJi:
                    general.BaojiNum += effectNum;
                    break;
                case AbilityType.MingZhong:
                    general.HitNum += effectNum;
                    break;
                case AbilityType.PoJi:
                    general.PojiNum += effectNum;
                    break;
                case AbilityType.RenXing:
                    general.RenxingNum += effectNum;
                    break;
                case AbilityType.ShanBi:
                    general.ShanbiNum += effectNum;
                    break;
                case AbilityType.GeDang:
                    general.GedangNum += effectNum;
                    break;
                case AbilityType.BiSha:
                    general.BishaNum += effectNum;
                    break;
                case AbilityType.Qishi:
                    general.Momentum += effectNum.ToShort();
                    break;

                default:
                    break;
            }
        }
	public AbilityCoolDownMessage (AbilityType type, float coolDown, float timeElapsed):base(MessageType.AbilityCoolDownMessage)
	{
		AbilityType = type;
		CoolDown = coolDown;
		TimeElapsed = timeElapsed;
	}
Beispiel #57
0
 private static int GetEquAttrEffect(UserItemInfo item, AbilityType abilityType)
 {
     ItemEquAttrInfo equAttr = new ConfigCacheSet<ItemEquAttrInfo>().FindKey(item.ItemID, abilityType);
     return (equAttr != null ? equAttr.GetEffectNum(item.ItemLv) : 0);
 }
Beispiel #58
0
 /// <summary>
 /// Increase the given ability with the given amount.
 /// </summary>
 /// <param name="type">Specifies the ability to increase</param>
 /// <param name="points">A positive value. Providing a negative value has no effect</param>
 public void IncreaseAbility(AbilityType type, int points)
 {
     if (IsNew) {
         _abilities.AddPoints(points);
     }
     _abilities.Increase(type, points);
 }
Beispiel #59
0
 private static decimal GetCareerAddition(CareerInfo careerInfo, AbilityType abilityType)
 {
     CareerAdditionInfo addition = new ConfigCacheSet<CareerAdditionInfo>().FindKey(careerInfo.CareerID, abilityType);
     return addition != null ? addition.AdditionNum : 0;
 }
	public AbilityObjectRemovedMessage(AbilityType atype):base(MessageType.AbilityObjectRemoved){
		Atype = atype;
	}