Inheritance: MonoBehaviour
Beispiel #1
0
 public AttackDescription(LivingEntity ent,
                          bool withVariation    = true,
                          AttackKind attackKind = AttackKind.Unset,//if uset it will be based on current weapon/active fi
                          OffensiveSpell spell  = null)
 {
     fightItem = null;
     Calc(ent, withVariation, ref attackKind, spell);
 }
Beispiel #2
0
 /// <summary>初始化</summary>
 private void Init()
 {
     Player    = new Player();
     Fight     = new FightItem();
     TaskItems = new List <TaskItem>();
     SPM       = new ConcurrentDictionary <string, ASObject>();
     //CCI = new ConcurrentDictionary<string, bool>();
     CharTime = (DateTime.Now.Ticks - 621355968000000000) / 10000;
 }
Beispiel #3
0
        public static FightItem GetActiveFightItem(LivingEntity ent)
        {
            var fightItem = ent.GetActivatedFightItem();

            if (fightItem == null)
            {
                fightItem = ent.GetFightItemFromActiveProjectileAbility();
            }

            return(fightItem);
        }
Beispiel #4
0
        /// <summary>获取玩家战斗信息</summary>
        public FightItem GetFight(Player player)
        {
            var personal = tg_fight_personal.GetFindByUserId(player.User.id) ?? InitFightPersonal(player);
            var fight    = new FightItem
            {
                Personal  = personal,
                Type      = FightType.ONE_SIDE,
                BoutCount = 0,
                Rival     = 0,
            };

            return(fight);
        }
Beispiel #5
0
        private static void IncreaseAbility(Hero hero, FightItem fi, int?steps = null)//AbilityKind kind)
        {
            var ab = hero.GetActiveAbility(fi.AbilityKind);

            hero.AbilityPoints = steps.HasValue ? steps.Value : ab.MaxLevel;
            hero.Level         = 11;
            var max = hero.AbilityPoints;

            for (int i = 0; i < max; i++)
            {
                var inc = hero.IncreaseAbility(fi.AbilityKind);
                Assert.IsTrue(inc);
            }
        }
Beispiel #6
0
    void AddItems()
    {
        for (int i = 0; i < fightItems.Count; i++)
        {
            Text itemText = Instantiate(txt);
            itemText.transform.SetParent(transform, false);
            RectTransform rt = itemText.GetComponent <RectTransform> ();
            rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, i * 150, 150);

            FightItem      item  = itemText.GetComponent <FightItem> ();
            FightItemModel model = fightItems[i];
            item.Bind(model, this);
        }

        RectTransform rootRt = GetComponent <RectTransform> ();

        rootRt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, fightItems.Count * 150);

        scrollBar.value = 0.001f;
    }
Beispiel #7
0
 public override void RemoveFightItem(FightItem fi)
 {
     fightItems[fi.FightItemKind].Count--;
     EverUsedFightItem = true;
 }
Beispiel #8
0
 public override void RemoveFightItem(FightItem fi)
 {
     fightItems[fi.FightItemKind].Count--;
 }
Beispiel #9
0
        private void Calc(LivingEntity ent, bool withVariation, ref AttackKind attackKind, OffensiveSpell spell)
        {
            try
            {
                this.withVariation = withVariation;
                this.spell         = spell;
                NonPhysical        = new Dictionary <EntityStatKind, float>();
                this.ent           = ent;
                Weapon wpn = null;
                //if (ent != null)//can be if using WeaponElementalProjectile
                {
                    wpn = ent.GetActiveWeapon();

                    attackKind = DiscoverAttackKind(attackKind, wpn);
                    AttackKind = attackKind;
                }

                if (AttackKind == AttackKind.SpellElementalProjectile && spell == null)
                {
                    return;
                }

                if (attackKind == AttackKind.PhysicalProjectile)
                {
                    fightItem = GetActiveFightItem(ent);
                    if (fightItem == null)
                    {
                        return;
                    }
                }
                if (attackKind == AttackKind.WeaponElementalProjectile)
                {
                    if (wpn != null)
                    {
                        if (wpn.SpellSource == null || wpn.SpellSource.Count == 0)
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                Dictionary <Weapon.WeaponKind, EntityStatKind> weapons2Esk = null;
                EntityStatKind attackStat = EntityStatKind.Unset;
                if (attackKind == AttackKind.Melee)
                {
                    attackStat = EntityStatKind.MeleeAttack;

                    weapons2Esk = AdvancedLivingEntity.MalleeWeapons2Esk;
                    if (wpn != null && wpn.IsMagician)
                    {
                        weapons2Esk = AdvancedLivingEntity.ProjectileWeapons2Esk;
                    }
                }
                else if (attackKind == AttackKind.PhysicalProjectile ||
                         attackKind == AttackKind.WeaponElementalProjectile)
                {
                    attackStat = EntityStatKind.Unset;
                    if (attackKind == AttackKind.PhysicalProjectile)
                    {
                        attackStat = EntityStatKind.PhysicalProjectilesAttack;
                    }
                    else
                    {
                        attackStat = EntityStatKind.ElementalWeaponProjectilesAttack;
                    }
                    weapons2Esk = AdvancedLivingEntity.ProjectileWeapons2Esk;
                }
                CalcMembers(ent, wpn, weapons2Esk, attackStat, attackKind);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Beispiel #10
0
        private void Calc(LivingEntity ent, bool withVariation, ref AttackKind attackKind, OffensiveSpell spell)
        {
            try
            {
                this.withVariation = withVariation;
                this.spell         = spell;
                NonPhysical        = new Dictionary <EntityStatKind, float>();
                this.ent           = ent;
                var wpn = ent.GetActiveWeapon();

                attackKind = DiscoverAttackKind(attackKind, wpn);

                if (attackKind == AttackKind.PhysicalProjectile)
                {
                    fightItem = ent.ActiveFightItem;
                    if (fightItem == null)
                    {
                        fightItem = ent.RecentlyActivatedFightItem;//HACK
                        if (fightItem == null)
                        {
                            return;
                        }
                    }
                }
                if (attackKind == AttackKind.WeaponElementalProjectile)
                {
                    //if (wpn != null && )
                    //{
                    //  if (wpn.SpellSource.Count == 0)
                    //    return;
                    //}
                }

                Dictionary <Weapon.WeaponKind, EntityStatKind> weapons2Esk = null;
                EntityStatKind attackStat = EntityStatKind.Unset;
                if (attackKind == AttackKind.Melee)
                {
                    attackStat = EntityStatKind.MeleeAttack;

                    weapons2Esk = AdvancedLivingEntity.MalleeWeapons2Esk;
                    if (wpn != null && wpn.IsMagician)
                    {
                        weapons2Esk = AdvancedLivingEntity.ProjectileWeapons2Esk;
                    }
                }
                else if (attackKind == AttackKind.PhysicalProjectile ||
                         attackKind == AttackKind.WeaponElementalProjectile)
                {
                    attackStat = EntityStatKind.Unset;
                    if (attackKind == AttackKind.PhysicalProjectile)
                    {
                        attackStat = EntityStatKind.PhysicalProjectilesAttack;
                    }
                    else
                    {
                        attackStat = EntityStatKind.ElementalWeaponProjectilesAttack;
                    }
                    weapons2Esk = AdvancedLivingEntity.ProjectileWeapons2Esk;
                }
                CalcMembers(ent, wpn, weapons2Esk, attackStat, attackKind);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            //finally
            //{
            //  if (CurrentTotal == 0 && attackKind != AttackKind.Melee)
            //  {
            //    AttackKind attackKindAlt = AttackKind.Melee;
            //    Calc(ent, withVariation, ref attackKindAlt, spell);
            //  }
            //}
        }