Exemple #1
0
        public static void dealDamage(Unit attacker, Unit victim)
        {
            if (attacker.Inv.Wielded != null)
            {

                int finalDamage = CalculateDamage(attacker, victim);
                if (attacker.Inv.Wielded.TypeOfDamage == Weapon.damageTypes.stab && victim.IsUnaware())
                {
                    finalDamage *= 6; //zomg
                    if (attacker is Player)
                        Log.AddLine("You silently stabbed " + victim.Name + "'s neck with your " + attacker.Inv.Wielded.Name + "!!");
                    else
                        Log.AddLine(attacker.Name + " stabs " + victim.Name + " with the " + attacker.Inv.Wielded.Name + "!");
                }
                else
                {
                    if (attacker is Player)
                        Log.AddLine("You hit " + victim.Name + " with your " + attacker.Inv.Wielded.Name + "!");
                    else
                        Log.AddLine(attacker.Name + " hits " + victim.Name + " with the " + attacker.Inv.Wielded.Name + "!");
                }

                victim.Hitpoints -= finalDamage;
                if (attacker is Player)
                    Log.AddDebugMessage(" " + finalDamage.ToString() + " damage");

                if (victim is Player)
                {
                    Gameover.KilledBy = attacker.Name;
                    if (victim.Hitpoints < victim.GetMaxHitpoints() / 3 || victim.Hitpoints < 3)
                        Log.AddAlertMessage("!!LOW HITPOINT WARNING!!");
                }
            }
        }
Exemple #2
0
 public static void Strangle(Unit attacker, Unit victim)
 {
     if (victim.IsUnaware())
     {
         int kotime = Algorithms.getRandomInt(50, 150);
         victim.KnockedOutTime += 150;
         if (attacker is Player)
             Log.AddLine("You strangle " + victim.Name + "!");
     }
     else
         Log.AddLine(attacker.Name + " tried to grab and strangle " + victim.Name + ", but the victim was aware of it!");
 }
Exemple #3
0
 public static void Strangle(Unit attacker, Unit victim)
 {
     if (victim.IsUnaware())
     {
         int KOtime = MyRandom.getRandomInt(50, 150);
         victim.KnockedOutTime += KOtime;
         if (attacker is Player)
         {
             Log.AddLine("You strangle " + victim.Name + "!");
         }
     }
     else
     {
         Log.AddLine(attacker.Name + " tried to grab and strangle " + victim.Name + ", but the victim was aware of it!");
     }
 }
Exemple #4
0
        public static void MeleeAttack(Unit attacker, Unit victim)
        {
            Weapon attackerWeapon = attacker.Inv.Wielded;

            if (attackerWeapon != null)
            {
                if (!attackerWeapon.targetInMeleeRange(attacker.CoordX, attacker.CoordY, victim.CoordX, victim.CoordY))
                {
                    //Zomg error
                    _DEBUG.AddDebugMessage("ERROR: attempt to melee from non-melee range.");
                }

                attacker.Timing.AddActionTime(TimeCost.MeleeAttackCost(attacker));
                int  finalDamage   = CalculateMeleeDamage(attacker, victim);
                bool victimStabbed = false;

                if (attacker.Inv.Wielded.TypeOfMeleeDamage == Weapon.MeleeDamageTypes.Stab && victim.IsUnaware())
                {
                    finalDamage *= 6; //zomg
                    Log.AddOneFromList(StringFactory.AttackerStabsVictim(attacker, victim));
                    victimStabbed = true;
                }
                else
                {
                    if (attacker is Player)
                    {
                        Log.AddLine("You hit " + victim.Name + " with your " + attacker.Inv.Wielded.DisplayName + "!");
                    }
                    else
                    {
                        Log.AddLine(attacker.Name + " hits " + victim.Name + " with the " + attacker.Inv.Wielded.DisplayName + "!");
                    }
                }

                victim.Hitpoints -= finalDamage;
                if (attacker is Player)
                {
                    _DEBUG.AddDebugMessage(" " + finalDamage.ToString() + " damage");
                }

                if (victim is Player)
                {
                    Gameover.KilledBy = attacker.Name;
                    if (victim.Hitpoints < victim.GetMaxHitpoints() / 3 || victim.Hitpoints < 3)
                    {
                        Log.AddAlertMessage("!!LOW HITPOINT WARNING!!");
                    }
                }
                if (victimStabbed)
                {
                    Log.AddOneFromList(StringFactory.stabbedVictimReacts(victim));
                }
            }
        }