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!!"); } } }
static int CalculateDamage(Unit attacker, Unit victim) { int mindamage = attacker.Inv.Wielded.mindamage; int maxdamage = attacker.Inv.Wielded.maxdamage; int baseDamage = Algorithms.getRandomInt(mindamage, maxdamage+1); int finalDamage = (int)(baseDamage + baseDamage * (attacker.Stats.Strength - 10)/10 * attacker.Inv.Wielded.StrengthFactor); if (finalDamage < 0) finalDamage = 0; return finalDamage; }
public Corpse(Unit deadman) { Appearance = '&'; weight = 25; CoordX = deadman.CoordX; CoordY = deadman.CoordY; Name = deadman.Name + " corpse"; Color = deadman.color; }
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!"); }
public UnconsciousBody(Unit victim) { Appearance = '&'; weight = 25; CoordX = victim.CoordX; CoordY = victim.CoordY; Name = "unconscious " + victim.Name; Color = victim.color; TurnToWakeUp = victim.Timing.GetCurrentTurn() + victim.KnockedOutTime; Knocked = victim; Knocked.KnockedOutTime = 0; }
public static int MoveCost(Unit acting) { int agi = acting.Stats.Agility; double encumbrance = acting.Inv.getEncumbrance(); double endurance = acting.Stats.Endurance; double encumbModifier; double baseCost = 10 + (10 - agi) / 2; if (encumbrance == 0) encumbModifier = 1; else encumbModifier = (10/endurance) * (1 + encumbrance / 2); //if encumbered double finalCost = baseCost * encumbModifier; return (int)Math.Round(finalCost); }
public Inventory(Unit ownr) { owner = ownr; }
//do we see the player? bool ActorSeesTheTarget() { Target = World.player; int targetX, targetY; targetX = Target.CoordX; targetY = Target.CoordY; int vectorX = Target.CoordX - CoordX; int vectorY = Target.CoordY - CoordY; double distance = Math.Sqrt(vectorX * vectorX + vectorY * vectorY); if (distance <= visibilityRadius) { if (ViewSector.PointIsInSector(CoordX, CoordY, targetX, targetY, lookX, lookY, ViewAngle)) if (WorldLOS.VisibleLineExist(CoordX, CoordY, targetX, targetY)) return true; } return false; }
public static int TurningCost(Unit acting) { return 3; }
public static int StrangleCost(Unit acting) { return Algorithms.getRandomInt(15, 25); }
public static int SkipTurnCost(Unit acting) { return 10; }
public static int PeepCost(Unit acting) { return 15; }
public static int OpenDoorCost(Unit acting) { return 10; }
public static int ContinuePeepCost(Unit acting) { return 10; }
public static int CloseDoorCost(Unit acting) { return 10; }
public static int AttackCost(Unit acting) { return 10; }