コード例 #1
0
    private IEnumerator ArtificialWaitOnAttack(EAttackType _attackType, float _wait)
    {
        CallAnimator(ANIMATION_BITE);
        yield return(new WaitForSeconds(_wait));

        TriggerAbility(_attackType);
    }
コード例 #2
0
 protected override void ApplyDamage(List <List <ZDObject> > Hits, EAttackType Type)
 {
     if (Hits != null)
     {
         foreach (var HitList in Hits)
         {
             if (HitList == null)
             {
                 continue;
             }
             for (int i = 0, _i = HitList.Count; i < _i; ++i)
             {
                 var Obj = HitList[i];
                 if (Obj is IADamageObject HitObj)
                 {
                     if (HitObj is Character HitChar && HitChar.TeamID == this.TeamID)
                     {
                         continue;
                     }
                     HitObj.Hurt(GetFinalAttackDamage(Type));
                     CreateHitEffectAt(Obj.transform.position);
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: EntityInventory.cs プロジェクト: kojosamwoode/MOBA2
    public bool ServerTryRemoveItem(int slot)
    {
        if (slot < 0 || slot > m_inventorySlots.Count)
        {
            return(false);
        }
        InventoryItem item = m_inventorySlots[slot].Item;

        if (item == null)
        {
            return(false);
        }

        if (TryRemoveStackItem(item))
        {
            //m_currency.AddCurrency(item.ItemContainer.Cost.Ammount / 2);
            return(true);
        }
        //Remove Ability from the character
        EAttackType attackType = (EAttackType)Enum.Parse(typeof(EAttackType), "ItemSlot" + item.Slot);

        m_entity.EntityAbilities.RemoveAbility(attackType);

        foreach (SideEffect effect in item.ActiveSideEffect)
        {
            m_entity.EntityAbilities.RemoveSideEffect(effect);
        }

        m_inventorySlots[slot].RemoveItem();
        RpcUpdateSlot(slot, "", 0, 0);
        return(true);
    }
コード例 #4
0
ファイル: EntityInventory.cs プロジェクト: kojosamwoode/MOBA2
    public void ItemUsed(EAttackType slot)
    {
        string slotString = slot.ToString().Replace("ItemSlot", "");

        //InventorySlot inventorySlot = GetInventorySlot(int.Parse(slotString));
        ServerTryRemoveItem(int.Parse(slotString));
    }
コード例 #5
0
    public override void Initialize(MobaEntity entity, Ability ability, EAttackType attackType)
    {
        base.Initialize(entity, ability, attackType);
        //Ability holder = m_entity.EntityAbilities.GetAbility(ability.AttackType);
        switch (m_ability.AbilityBase.TargetType)
        {
        case ETargetType.EntityTarget:
            m_rangueImageIndicator = CreateImageIndicator(m_ability.AbilityBase.RangeImageIndicator, new Vector3(ability.Range * 2, 1, ability.Range * 2));
            break;

        case ETargetType.PositionTarget:
            m_rangueImageIndicator = CreateImageIndicator(m_ability.AbilityBase.RangeImageIndicator, new Vector3(ability.Range * 2, 1, ability.Range * 2));
            if (m_ability.AbilityBase.SkillShotType == ESkillShotType.FloorSkill)
            {
                m_targetImageIndicator = CreateImageIndicator(m_ability.AbilityBase.TargetImageIndicator, new Vector3(ability.AbilityBase.AoeRange, 1, ability.AbilityBase.AoeRange));
            }
            else
            {
                m_targetImageIndicator = CreateImageIndicator(m_ability.AbilityBase.TargetImageIndicator, Vector3.one);
            }
            break;

        case ETargetType.SelfTarget:
            break;

        case ETargetType.RandomTarget:
            break;

        case ETargetType.AllTarget:
            break;

        default:
            break;
        }
    }
コード例 #6
0
ファイル: EntityAbilities.cs プロジェクト: kojosamwoode/MOBA2
 public void ResetAllColdDown(EAttackType abilityType)
 {
     foreach (Ability ability in m_abilities.Values)
     {
         ability.CoolDown = 0;
     }
 }
コード例 #7
0
ファイル: Monster.cs プロジェクト: nezbo/Descent
        /// <summary>
        /// Initializes a new instance of the <see cref="Monster"/> class.
        /// </summary>
        /// <param name="id">
        /// The monster id
        /// This is unique for all monsters, even several instances of
        /// the same monster.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="master">
        /// The master.
        /// </param>
        /// <param name="speed">
        /// The speed.
        /// </param>
        /// <param name="health">
        /// The health.
        /// </param>
        /// <param name="armor">
        /// The armor.
        /// </param>
        /// <param name="type">
        /// The type.
        /// </param>
        /// <param name="dice">
        /// The dice.
        /// </param>
        public Monster(int id, string name, bool master, int speed, int health, int armor, EAttackType type, List<Dice> dice, List<Ability> abilities, Rectangle size, Texture2D texture)
            : base(id, name, size)
        {
            Contract.Requires(name != null);
            Contract.Requires(name.Length > 0);
            Contract.Requires(size.Width > 0 && size.Height > 0);
            Contract.Requires(speed > 0);
            Contract.Requires(health > 0);
            Contract.Requires(armor >= 0);
            Contract.Requires(type != EAttackType.NONE);
            Contract.Requires(dice != null);

            isMaster = master;
            Speed = speed;
            MaxHealth = health;
            this.health = health;
            Armor = armor;
            attackType = type;
            DiceForAttack = dice;
            this.Texture = texture;

            Abilities = abilities;
            foreach (Ability ability in abilities)
            {
                ability.Apply(this);
            }
        }
コード例 #8
0
    protected override void Attack(Vector2 Direction, EAttackType Type)
    {
        FaceTo(Direction);

        switch (Type)
        {
        case EAttackType.N:
            animator.SetTrigger("AttackN");
            break;

        case EAttackType.A:
            animator.SetTrigger("AttackA");
            break;

        case EAttackType.B:
            animator.SetTrigger("AttackB");
            break;

        case EAttackType.R:
            animator.SetTrigger("AttackR");
            break;

        default:
            break;
        }
    }
コード例 #9
0
ファイル: EntityAbilities.cs プロジェクト: kojosamwoode/MOBA2
 public void RemoveAbility(EAttackType type)
 {
     if (m_abilities.ContainsKey(type))
     {
         m_abilities.Remove(type);
     }
 }
コード例 #10
0
    public override void SetRandomValues(int level)
    {
        base.SetRandomValues(level);

        attackType = InventoryManager.GetRandomEnum <EAttackType>();

        damageMultiplier = 1f + level * 0.1f;
    }
コード例 #11
0
 public Ability(AbilityBase abilityBase, EAttackType type, MobaEntity entity)
 {
     m_abilityBase = abilityBase;
     m_mobaEntity  = entity;
     //Only basic abilities starts at level 1
     m_attackType = type;
     Level        = m_attackType == EAttackType.Basic ? 1 : 0;
 }
コード例 #12
0
    public override void SetRandomValues(int level)
    {
        base.SetRandomValues(level);

        attackType = InventoryManager.GetRandomEnum <EAttackType>();

        statMod = new StatMod(1f + level * 0.1f, false, true, 60 * level, "Movespeed");
    }
コード例 #13
0
 protected override void Attack(Vector2 Direction, EAttackType Type)
 {
     if (photonView.IsMine)
     {
         //Reduce Soul
         SetSoul(Soul - (int)Type);
     }
     base.Attack(Direction, Type);
 }
コード例 #14
0
ファイル: EntityAbilities.cs プロジェクト: kojosamwoode/MOBA2
 public int GetAbilityLevel(EAttackType type)
 {
     if (m_abilities.ContainsKey(type))
     {
         return(m_abilities[type].Level);
     }
     Debug.LogError("Ability identifier" + type + " for: not found on the Abilties");
     return(0);
 }
コード例 #15
0
    /// <summary>
    /// Get an ability from its Identifier
    /// </summary>
    /// <param name="identifier">Ability Identifier</param>
    /// <returns>AbilityBase</returns>
    public Ability GenerateEntityAbility(string identifier, EAttackType type, MobaEntity entity)
    {
        if (m_abilitiesDic.ContainsKey(identifier))
        {
            return(new Ability(m_abilitiesDic[identifier], type, entity));
        }

        return(null);
    }
コード例 #16
0
 public override void InputAttack(Vector2 AttackDirection, EAttackType Type)
 {
     Debug.Log(Type);
     if (photonView.IsMine && IsInputAttackValid(AttackDirection, Type))
     {
         SetMP(GetMP() - SkillMana[(int)Type] * basicValues.ReduceManaCost);
         SkillCD[(int)Type] = MaxSkillCD[(int)Type] * basicValues.CDR;
         photonView.RPC("RPCAttack", RpcTarget.AllViaServer, AttackDirection, Type);
     }
 }
コード例 #17
0
 // 生成攻击数据,普通攻击 def 是有值的,技能攻击没有值
 protected void startAtt(SceneCardBase att, SceneCardBase def, EAttackType attackType, stNotifyBattleCardPropertyUserCmd msg)
 {
     if (att != null)
     {
         Ctx.m_instance.m_logSys.fightLog(string.Format("[Fight] 攻击者详细信息 {0}", att.getDesc()));
         // 攻击
         AttackItemBase attItem = null;
         attItem = att.fightData.attackData.createItem(attackType);
         attItem.initItemData(att, def, msg);
     }
 }
コード例 #18
0
    public void UpdateInventoryItem(InventoryItem item, Action <ItemButton> onItemClicked = null)
    {
        if (item != null)
        {
            //If the ability is active subscribe to update CDR
            if (item.ItemContainer.AbilityBase)
            {
                EAttackType attackType = (EAttackType)Enum.Parse(typeof(EAttackType), "ItemSlot" + item.Slot);
                Ability     ability    = item.Entity.EntityAbilities.GetAbility(attackType);
                if (ability != null)
                {
                    ability.m_onDataUpdated += UpdateAbility;
                    m_ability = ability;
                }
                else
                {
                    Debug.LogError("Error. Ability is null??");
                }
            }

            UpdateItemContainer(item.ItemContainer, onItemClicked);
            if (m_stacks)
            {
                m_stacks.text = item.Stacks.ToString();
                if (item.Stacks == 1)
                {
                    m_stacks.gameObject.SetActive(false);
                }
                else
                {
                    m_stacks.gameObject.SetActive(true);
                }
            }
            m_slot = item.Slot;
        }
        else
        {
            if (m_ability != null)
            {
                m_ability.m_onDataUpdated -= UpdateAbility;
                m_cdrImage.fillAmount      = 0;
                m_ability.MobaEntity.EntityAbilities.RemoveAbility(m_ability.AttackType);
            }
            UpdateItemContainer(null, onItemClicked);

            if (m_stacks)
            {
                m_stacks.gameObject.SetActive(false);
            }
        }
        m_item = item;
    }
コード例 #19
0
        // 攻击者攻击被击者
        protected void attackTo(SceneCardBase att, SceneCardBase def, EAttackType attackType, stNotifyBattleCardPropertyUserCmd msg)
        {
            if (att != null && def != null)
            {
                Ctx.m_instance.m_logSys.fightLog(string.Format("[Fight] 被击者详细信息 {0}", def.getDesc()));
                // 受伤
                HurtItemBase hurtItem = null;
                hurtItem = def.fightData.hurtData.createItem((EHurtType)attackType);
                hurtItem.initItemData(att, def, msg);
                def.fightData.hurtData.allHurtExecEndDisp.addEventHandle(onOneAttackAndHurtEndHandle);

                m_hurtList.Add(def.fightData.hurtData);
            }
        }
コード例 #20
0
ファイル: AttackData.cs プロジェクト: zhutaorun/unitygame
        public AttackItemBase createItem(EAttackType type)
        {
            AttackItemBase ret = null;
            if (EAttackType.eCommon == type)
            {
                ret = new ComAttackItem(type);
            }
            else if(EAttackType.eSkill== type)
            {
                ret = new SkillAttackItem(type);
            }

            m_attackList.Add(ret);
            return ret;
        }
コード例 #21
0
        public AttackItemBase createItem(EAttackType type)
        {
            AttackItemBase ret = null;

            if (EAttackType.eCommon == type)
            {
                ret = new ComAttackItem(type);
            }
            else if (EAttackType.eSkill == type)
            {
                ret = new SkillAttackItem(type);
            }

            m_attackList.Add(ret);
            return(ret);
        }
コード例 #22
0
ファイル: EntityInventory.cs プロジェクト: kojosamwoode/MOBA2
 public void ClientInventoryItemClicked(ItemButton itemButton)
 {
     if (itemButton.InventoryItem != null)
     {
         BaseItemContainer baseItem = itemButton.InventoryItem.ItemContainer;
         if (baseItem != null && baseItem.ItemUseType == BaseItemContainer.EItemUseType.Active)
         {
             if (baseItem.AbilityBase)
             {
                 CharacterLogic characterLogic = m_entity.EntityLogic as CharacterLogic;
                 EAttackType    attackType     = (EAttackType)Enum.Parse(typeof(EAttackType), "ItemSlot" + itemButton.Slot);
                 characterLogic.TryToCastAbilityOnClient(attackType, false);
             }
         }
     }
 }
コード例 #23
0
    public static bool CheckIfDamageApplies(EAttackType attackType, EAttackClass eAttackClass)
    {
        switch (eAttackClass)
        {
        case EAttackClass.Tilts:
        {
            if (attackType == EAttackType.DTilt || attackType == EAttackType.UTilt || attackType == EAttackType.FTilt ||
                attackType == EAttackType.Jab1 || attackType == EAttackType.DashAtk)
            {
                return(true);
            }
            break;
        }

        case EAttackClass.Aerials:
        {
            if (attackType == EAttackType.NAir || attackType == EAttackType.DAir || attackType == EAttackType.UAir ||
                attackType == EAttackType.FAir || attackType == EAttackType.BAir)
            {
                return(true);
            }
            break;
        }

        case EAttackClass.Strongs:
        {
            if (attackType == EAttackType.USoul || attackType == EAttackType.DSoul || attackType == EAttackType.FSoul)
            {
                return(true);
            }
            break;
        }

        case EAttackClass.Specials:
        {
            if (attackType == EAttackType.NSpec || attackType == EAttackType.FSpec || attackType == EAttackType.DSpec || attackType == EAttackType.USpec)
            {
                return(true);
            }
            break;
        }

        default: break;
        }

        return(false);
    }
コード例 #24
0
ファイル: EntityAbilities.cs プロジェクト: kojosamwoode/MOBA2
    public void RpcSetAbilityLevel(int attackType, int level)
    {
        EAttackType type = (EAttackType)attackType;

        if (m_abilities.ContainsKey(type))
        {
            m_abilities[type].Level = level;
            if (AbilityLevelUpCallback != null)
            {
                AbilityLevelUpCallback(m_abilities[type]);
            }
        }
        else
        {
            Debug.LogError("Error: Ability type does not exist: " + type);
        }
    }
コード例 #25
0
 private void SetupStanceToBlockAttack(PlayerBaseAttackLogic attackLogic)
 {
     // In order to simulate the correct blocking anim
     // If this is a low attack type, need to force crouch to the dummy
     if (attackLogic is PlayerNormalAttackLogic normalAttackLogic)
     {
         EAttackType attackType = normalAttackLogic.GetNormalAttackConfig().m_AttackType;
         if (attackType == EAttackType.Low)
         {
             m_MovementComponent.ForceCrouchInput(true);
         }
         else if (attackType == EAttackType.Overhead)
         {
             m_MovementComponent.ForceCrouchInput(false);
         }
     }
 }
コード例 #26
0
ファイル: Ruso.cs プロジェクト: Teddy12155555/ZoneDepict
    public override void InputAttack(Vector2 AttackDirection, EAttackType Type)
    {
        switch (Type)
        {
        case EAttackType.N:
            break;

        default:
            if (Soul == (int)EAttackType.A &&
                !ZDGameRule.QuadrifyDirection(AttackDirection).y.Equals(0))
            {
                return;
            }
            break;
        }
        base.InputAttack(AttackDirection, Type);
    }
コード例 #27
0
ファイル: Character.cs プロジェクト: clifordunique/DeathBros
    public CS_Attack GetAttackState(EAttackType attackType)
    {
        CS_Attack returnState = null;

        for (int i = 0; i < cStates.Count; i++)
        {
            if (cStates[i] is CS_Attack)
            {
                CS_Attack checkAttackType = (CS_Attack)cStates[i];

                if (checkAttackType.attackType == attackType)
                {
                    returnState = (CS_Attack)cStates[i];
                }
            }
        }
        return(returnState);
    }
コード例 #28
0
    private void TriggerAbility(EAttackType _attackType)
    {
        var _triggerAbility = Array.Find(CollectionOfAttachedAbilities, element => element.attackType == _attackType);

        if (_triggerAbility)
        {
            if (_attackType == EAttackType.Ability_A)
            {
                currentBossAbility = _triggerAbility;
                _triggerAbility.GetComponent <AbilityA>().TriggerA(playerCol.transform);
                //_triggerAbility.Trigger(GetDirecitonForAbilityAttack(_attackType));
            }
            else
            {
                currentBossAbility = _triggerAbility;
                _triggerAbility.Trigger(GetDirecitonForAbilityAttack(_attackType));
            }
        }
    }
コード例 #29
0
ファイル: EntityInventory.cs プロジェクト: kojosamwoode/MOBA2
 public bool ServerAddItemToIventory(InventoryItem item)
 {
     if (HasSlots)
     {
         int emptySlotIndex = GetFreeSlot();
         if (emptySlotIndex != -1)
         {
             item.Slot = emptySlotIndex;
             m_inventorySlots[emptySlotIndex].AddItem(item);
             if (item.ItemContainer.AbilityBase != null)
             {
                 EAttackType attackType = (EAttackType)Enum.Parse(typeof(EAttackType), "ItemSlot" + emptySlotIndex);
                 m_entity.EntityAbilities.AddAbility(attackType, item.ItemContainer.AbilityBase.Identifier, 1);
             }
             RpcUpdateSlot(item.Slot, item.ItemContainer.Identifier, item.Charges, item.Stacks);
             return(true);
         }
     }
     return(false);
 }
コード例 #30
0
ファイル: EntityAbilities.cs プロジェクト: kojosamwoode/MOBA2
    public void AddAbility(EAttackType type, string abilityIdentifier, int level = 0)
    {
        Ability ability = AbilityManager.instance.GenerateEntityAbility(abilityIdentifier, type, m_mobaEntity);

        ability.Level = level;
        if (ability != null)
        {
            if (m_abilities.ContainsKey(type))
            {
                Debug.LogError("Error: Ability AlreadyCreated");
            }
            else
            {
                m_abilities.Add(type, ability);
            }
        }
        else
        {
            Debug.LogError("Error: AbilityBase is Null");
        }
    }
コード例 #31
0
    private Vector2 GetDirecitonForAbilityAttack(EAttackType _attackType)
    {
        Vector3 _direction = new Vector3(0, 0, 0);

        if (_attackType == EAttackType.Ability_A)
        {
            _direction = (playerCol.transform.position - projectileAFiringPt.position).normalized;
            Debug.DrawRay(projectileAFiringPt.position, _direction, Color.red, 3f);
            return(_direction);
        }
        else if (_attackType == EAttackType.Ability_B)
        {
            _direction = (playerCol.transform.position - projectileBFiringPt.position).normalized;
            Debug.DrawRay(projectileBFiringPt.position, _direction, Color.red, 3f);
            return(_direction);
        }
        else
        {
            return(Vector2.zero);
        }
    }
コード例 #32
0
ファイル: EntityAbilities.cs プロジェクト: kojosamwoode/MOBA2
 public void ServerTryLevelUpAbility(EAttackType abilityType)
 {
     if (m_abilities[abilityType].CanLevelUp && m_abilities.ContainsKey(abilityType))
     {
         if (m_availablePoints <= 0)
         {
             Debug.LogError("Error: Not available ability points: " + abilityType);
             return;
         }
         m_availablePoints--;
         m_abilities[abilityType].Level++;
         RpcSetAbilityLevel((int)abilityType, m_abilities[abilityType].Level);
         if (AbilityLevelUpCallback != null)
         {
             AbilityLevelUpCallback(m_abilities[abilityType]);
         }
     }
     else
     {
         Debug.LogError("Error: Ability type does not exist: " + abilityType);
     }
 }
コード例 #33
0
ファイル: AttackItemBase.cs プロジェクト: zhutaorun/unitygame
        protected EventDispatch m_attackEndDisp;      // 整个攻击结束,从发起攻击,到回到原地

        public AttackItemBase(EAttackType attackType)
        {
            m_attackType = attackType;
            m_attackEndDisp = new AddOnceAndCallOnceEventDispatch();
        }
コード例 #34
0
ファイル: ComAttackItem.cs プロジェクト: zhutaorun/unitygame
        protected float m_moveTime;      // 攻击的时候移动到攻击目标的时间

        public ComAttackItem(EAttackType attackType) :
            base(attackType)
        {
            m_moveTime = AttackItemBase.ComAttMoveTime;
        }
コード例 #35
0
ファイル: Equipment.cs プロジェクト: nezbo/Descent
 /// <summary>
 /// Initializes a new instance of the <see cref="Equipment"/> class.
 /// </summary>
 /// <param name="id">
 /// The unique id of the equipment
 /// </param>
 /// <param name="name">
 /// The name of the equipment
 /// </param>
 /// <param name="type">
 /// The equipments type
 /// </param>
 /// <param name="attackType">
 /// The attack type of the equipment
 /// </param>
 /// <param name="rarity">
 /// The rarity of the equipment
 /// </param>
 /// <param name="buyPrice">
 /// The buy price of the equipment
 /// This is 0 if the equipments rarity is not common
 /// </param>
 /// <param name="surgeAbilities">
 /// The surge abilities, if the equipment is a weapon
 /// </param>
 /// <param name="hands">
 /// The number of hands it takes to wield, if the equipment is a weapon
 /// </param>
 /// <param name="abilities">
 /// The abilities that the equipment have
 /// </param>
 /// <param name="dice">
 /// The dice that the equipment has
 /// </param>
 public Equipment(int id, string name, EquipmentType type, EAttackType attackType, EquipmentRarity rarity, int buyPrice, List<SurgeAbility> surgeAbilities, int hands, List<Ability> abilities, List<Dice> dice)
 {
     Contract.Requires(surgeAbilities != null);
     Contract.Requires(abilities != null);
     this.id = id;
     this.name = name;
     this.type = type;
     this.attackType = attackType;
     this.rarity = rarity;
     this.buyPrice = rarity == EquipmentRarity.Common ? buyPrice : 0;
     this.surgeAbilities = surgeAbilities;
     this.hands = hands;
     this.abilities = abilities;
     this.dice = dice ?? new List<Dice>();
     tapped = false;
 }
コード例 #36
0
 // 生成攻击数据,普通攻击 def 是有值的,技能攻击没有值
 protected void startAtt(SceneCardBase att, SceneCardBase def, EAttackType attackType, stNotifyBattleCardPropertyUserCmd msg)
 {
     if (att != null)
     {
         Ctx.m_instance.m_logSys.fightLog(string.Format("[Fight] 攻击者详细信息 {0}", att.getDesc()));
         // 攻击
         AttackItemBase attItem = null;
         attItem = att.fightData.attackData.createItem(attackType);
         attItem.initItemData(att, def, msg);
     }
 }
コード例 #37
0
        // 攻击者攻击被击者
        protected void attackTo(SceneCardBase att, SceneCardBase def, EAttackType attackType, stNotifyBattleCardPropertyUserCmd msg)
        {
            if (att != null && def != null)
            {
                Ctx.m_instance.m_logSys.fightLog(string.Format("[Fight] 被击者详细信息 {0}", def.getDesc()));
                // 受伤
                HurtItemBase hurtItem = null;
                hurtItem = def.fightData.hurtData.createItem((EHurtType)attackType);
                hurtItem.initItemData(att, def, msg);
                def.fightData.hurtData.allHurtExecEndDisp.addEventHandle(onOneAttackAndHurtEndHandle);

                m_hurtList.Add(def.fightData.hurtData);
            }
        }
コード例 #38
0
        protected MList<uint> m_hurtIdList;     // 被击者 this id 列表

        public SkillAttackItem(EAttackType attackType) :
            base(attackType)
        {
            m_hurtIdList = new MList<uint>();
        }