Exemplo n.º 1
0
    private IEnumerator ArtificialWaitOnAttack(EAttackType _attackType, float _wait)
    {
        CallAnimator(ANIMATION_BITE);
        yield return(new WaitForSeconds(_wait));

        TriggerAbility(_attackType);
    }
 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);
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
    public void ItemUsed(EAttackType slot)
    {
        string slotString = slot.ToString().Replace("ItemSlot", "");

        //InventorySlot inventorySlot = GetInventorySlot(int.Parse(slotString));
        ServerTryRemoveItem(int.Parse(slotString));
    }
Exemplo n.º 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;
        }
    }
Exemplo n.º 6
0
 public void ResetAllColdDown(EAttackType abilityType)
 {
     foreach (Ability ability in m_abilities.Values)
     {
         ability.CoolDown = 0;
     }
 }
Exemplo n.º 7
0
        /// <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);
            }
        }
    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;
        }
    }
Exemplo n.º 9
0
 public void RemoveAbility(EAttackType type)
 {
     if (m_abilities.ContainsKey(type))
     {
         m_abilities.Remove(type);
     }
 }
Exemplo n.º 10
0
    public override void SetRandomValues(int level)
    {
        base.SetRandomValues(level);

        attackType = InventoryManager.GetRandomEnum <EAttackType>();

        damageMultiplier = 1f + level * 0.1f;
    }
Exemplo n.º 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;
 }
Exemplo n.º 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");
    }
Exemplo n.º 13
0
 protected override void Attack(Vector2 Direction, EAttackType Type)
 {
     if (photonView.IsMine)
     {
         //Reduce Soul
         SetSoul(Soul - (int)Type);
     }
     base.Attack(Direction, Type);
 }
Exemplo n.º 14
0
 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);
 }
Exemplo n.º 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);
    }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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;
    }
Exemplo n.º 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);
            }
        }
Exemplo n.º 20
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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 22
0
 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);
             }
         }
     }
 }
Exemplo n.º 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);
    }
Exemplo n.º 24
0
    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);
        }
    }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 26
0
    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);
    }
Exemplo n.º 27
0
    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);
    }
Exemplo n.º 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));
            }
        }
    }
Exemplo n.º 29
0
 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);
 }
Exemplo n.º 30
0
    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");
        }
    }
Exemplo n.º 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);
        }
    }
Exemplo n.º 32
0
 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);
     }
 }
Exemplo n.º 33
0
        protected EventDispatch m_attackEndDisp;      // 整个攻击结束,从发起攻击,到回到原地

        public AttackItemBase(EAttackType attackType)
        {
            m_attackType = attackType;
            m_attackEndDisp = new AddOnceAndCallOnceEventDispatch();
        }
Exemplo n.º 34
0
        protected float m_moveTime;      // 攻击的时候移动到攻击目标的时间

        public ComAttackItem(EAttackType attackType) :
            base(attackType)
        {
            m_moveTime = AttackItemBase.ComAttMoveTime;
        }
Exemplo n.º 35
0
 /// <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;
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 38
0
        protected MList<uint> m_hurtIdList;     // 被击者 this id 列表

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