Ejemplo n.º 1
0
        public override void OnAction(L2Player player)
        {
            player.SendMessage(AsString());
            //    TimeSpan ts = dtstart - DateTime.Now;
            //    player.sendMessage($"timems {(ts.TotalMilliseconds)}");
            bool newtarget = false;

            if (player.CurrentTarget == null)
            {
                player.CurrentTarget = this;
                newtarget            = true;
            }
            else
            {
                if (player.CurrentTarget.ObjId != ObjId)
                {
                    player.CurrentTarget = this;
                    newtarget            = true;
                }
            }

            if (newtarget)
            {
                player.SendPacket(new MyTargetSelected(ObjId, player.Level - Template.Level));

                StatusUpdate su = new StatusUpdate(ObjId);
                su.Add(StatusUpdate.CurHp, (int)CurHp);
                su.Add(StatusUpdate.MaxHp, (int)CharacterStat.GetStat(EffectType.BMaxHp));
                player.SendPacket(su);
            }
            else
            {
                player.AiCharacter.Attack(this);
            }
        }
Ejemplo n.º 2
0
 public virtual void SetTemplate(NpcTemplate template)
 {
     Template = template;
     CStatsInit();
     //CharacterStat.setTemplate(template);
     CurHp       = CharacterStat.GetStat(EffectType.BMaxHp);
     MaxTime     = 1200; //20 минут
     CurrentTime = MaxTime;
     Level       = template.Level;
 }
Ejemplo n.º 3
0
        public override void OnActionShift(L2Player player)
        {
            string text = string.Empty;

            text += $"pdef: {CharacterStat.GetStat(EffectType.PPhysicalDefense)}<br>";
            text += $"patk: {CharacterStat.GetStat(EffectType.PPhysicalAttack)}<br>";
            text += $"curhp: {CurHp}<br>";
            text += $"maxhp: {CharacterStat.GetStat(EffectType.BMaxHp)}<br>";
            text += $"mdef: {CharacterStat.GetStat(EffectType.PMagicalAttack)}<br>";
            text += $"matk: {CharacterStat.GetStat(EffectType.PMagicalDefense)}<br>";

            player.ShowHtmPlain(text, null);
            player.SendActionFailed();
        }
Ejemplo n.º 4
0
 void Start()
 {
     goblinID = IDCounter++;
     //attack, defense, consitution, vitality
     goblinStats          = new CharacterStat(10, 10, 50, 50);
     currentHealth        = MaxHealth = (int)goblinStats.GetStat(StatType.Constitution).getTotalValue();
     dropTable            = new DropTable();
     dropTable.listOfDrop = new List <LootDrop>()
     {
         new LootDrop("Sword", 100),
         new LootDrop("Sword_2H", 0),
         new LootDrop("Axe", 0)
     };
     animator  = GetComponent <Animator>();
     weapon    = GameObject.FindGameObjectWithTag("EnemyWeapon").GetComponent <GoblinSword>();
     rigidBody = GetComponent <Rigidbody>();
     Debug.Log("start is null");
 }
Ejemplo n.º 5
0
 public void PerformAttack()
 {
     if (animator.GetBool("Attacking"))
     {
         float attackDamage = weapon.GetStats()[(int)StatType.Attack].getTotalValue() + goblinStats.GetStat(StatType.Attack).getTotalValue();
         weapon.PerformAttack((int)attackDamage);
     }
 }