/// <summary> /// Default constructor /// </summary> public Pit(Square block) : base(block) { if (block == null) throw new ArgumentNullException("block"); Damage = new Dice(); AcceptItems = true; CanPassThrough = true; IsBlocking = false; }
/// <summary> /// Default constructor /// </summary> public Monster() { ItemsInPocket = new List<string>(); DamageDice = new Dice(); HitDice = new Dice(); DefaultBehaviour = MonsterBehaviour.Aggressive; DrawOffsetDuration = TimeSpan.FromSeconds(1.0f + GameBase.Random.NextDouble()); HitDisplayDuration = TimeSpan.FromSeconds(0.5f); }
/// <summary> /// /// </summary> /// <returns></returns> int RollForAbility() { Dice dice = new Dice(1, 6, 0); List<int> list = new List<int>(); list.Add(dice.Roll()); list.Add(dice.Roll()); list.Add(dice.Roll()); list.Add(dice.Roll()); list.Sort(); return list[1] + list[2] + list[3]; }
//{ // if (attack == null) // return; // LastAttack = attack; // if (LastAttack.IsAMiss) // return; // HitPoint.Current -= LastAttack.Hit; // // Reward the team for having killed the entity // if (IsDead && attack.Striker is Hero) // { // (attack.Striker as Hero).Team.AddExperience(Reward); // } //} /// <summary> /// Make damage to the hero /// </summary> /// <param name="damage">Attack roll</param> /// <param name="type">Type of saving throw</param> /// <param name="difficulty">Difficulty</param> public void Damage(Dice damage, SavingThrowType type, int difficulty) { if (damage == null) return; int save = Dice.GetD20(1); // No damage if (save == 20 || save + SavingThrow(type) > difficulty) return; HitPoint.Current -= damage.Roll(); }
/// <summary> /// Make damage to the whole team /// </summary> /// <param name="damage">Attack roll</param> /// <param name="type">Type of saving throw</param> /// <param name="difficulty">Difficulty</param> public void Damage(Dice damage, SavingThrowType type, int difficulty) { foreach (Hero hero in Heroes) if (hero != null) hero.Damage(damage, type, difficulty); }
/// <summary> /// Constructor /// </summary> /// <param name="striker">Striker entity</param> /// <param name="Attacked">Attacked entity</param> /// <param name="item">Item used as a weapon. Use null for a hand attack</param> /// http://nwn2.wikia.com/wiki/Attack_sequence public Attack(Entity striker, Entity target, Item item) { Team team = GameScreen.Team; Time = DateTime.Now; Striker = striker; Target = target; Item = item; if (striker == null || target == null) return; // Ranged attack ? DungeonLocation from = null; DungeonLocation to = null; if (striker is Hero) from = team.Location; else from = ((Monster)striker).Location; if (target is Hero) to = team.Location; else to = ((Monster)target).Location; Range = (int)Math.Sqrt((from.Coordinate.Y - to.Coordinate.Y) * (from.Coordinate.Y - to.Coordinate.Y) + (from.Coordinate.X - to.Coordinate.X) * (from.Coordinate.X - to.Coordinate.X)); // Attack roll int attackdie = Dice.GetD20(1); // Critical fail ? if (attackdie == 1) attackdie = -100000; // Critical Hit ? if (attackdie == 20) attackdie = 100000; // Base attack bonus int baseattackbonus = 0; int modifier = 0; // modifier int sizemodifier = 0; // Size modifier int rangepenality = 0; // Range penality if (striker is Hero) { baseattackbonus = ((Hero)striker).BaseAttackBonus; } else if (striker is Monster) { Monster monster = striker as Monster; //sizemodifier = (int)monster.Size; } // Range penality if (RangedAttack) { modifier = striker.Dexterity.Modifier; //TODO : Add range penality } else modifier = striker.Strength.Modifier; // Attack bonus int attackbonus = baseattackbonus + modifier + sizemodifier + rangepenality; if (target.ArmorClass > attackdie + attackbonus) return; if (item != null) Hit = item.Damage.Roll(); else { Dice dice = new Dice(1, 4, 0); Hit = dice.Roll(); } if (IsAHit) Target.Hit(this); }
/// <summary> /// Copy a dice /// </summary> /// <param name="dice">Dice to copy from</param> public void Clone(Dice dice) { if (dice == null) return; Faces = dice.Faces; Throws = dice.Throws; Modifier = dice.Modifier; }