예제 #1
0
        public void Setup()
        {
            healer = new Healer();
            npc    = new Mock <INonPlayerCharacter>();
            room   = new Mock <IRoom>();
            pc     = new Mock <IPlayerCharacter>();
            random = new Mock <IRandom>();
            Mock <ISpell> spell = new Mock <ISpell>();
            Dictionary <string, ISpell> spellBook = new Dictionary <string, ISpell>();

            healer.CastPercent = 100;
            room.Setup(e => e.NonPlayerCharacters).Returns(new List <INonPlayerCharacter>()
            {
                npc.Object
            });
            room.Setup(e => e.PlayerCharacters).Returns(new List <IPlayerCharacter>()
            {
                pc.Object
            });
            random.Setup(e => e.PercentDiceRoll(100)).Returns(true);
            npc.Setup(e => e.Room).Returns(room.Object);
            npc.Setup(e => e.SpellBook).Returns(spellBook);
            pc.Setup(e => e.KeyWords).Returns(new List <string>()
            {
                "PC"
            });
            spell.Setup(e => e.SpellName).Returns("spell");
            spellBook.Add(spell.Object.SpellName, spell.Object);

            GlobalReference.GlobalValues.Random = random.Object;
        }
예제 #2
0
        public string Heal(string[] args)
        {
            string    healerName          = args[0];
            string    healingReceiverName = args[1];
            Character healer   = characters.FirstOrDefault(ch => ch.Name == healerName);
            Character receiver = characters.FirstOrDefault(ch => ch.Name == healingReceiverName);

            if (healer == null)
            {
                throw new ArgumentException($"Character {healerName} not found!");
            }
            if (receiver == null)
            {
                throw new ArgumentException($"Character {healingReceiverName} not found!");
            }

            if (healer.GetType().Name != nameof(Priest))
            {
                throw new ArgumentException($"{healerName} cannot heal!");
            }

            IHealer castedHealer = (IHealer)healer;

            castedHealer.Heal(receiver);

            StringBuilder sb = new StringBuilder();

            sb.AppendLine($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}! {receiver.Name} has {receiver.Health} health now!");

            return(sb.ToString().Trim());
        }
예제 #3
0
        void IDoHeal.OnHeal(IHealer source, IHealable target, int amount)
        {
            var player = target as IPlayer;

            if (player.Seat == Ui.Seat)
            {
                StartCoroutine(Play());
            }
        }
예제 #4
0
파일: Healer.cs 프로젝트: Karlinna/depths
 public virtual void GetHeal(int value, IHealer got)
 {
     if (Health + value > HealthMax)
     {
         Health = HealthMax;
     }
     else
     {
         Health += value;
     }
 }
예제 #5
0
 public Commands(
     IMovement movement,
     IRoomActions roomActions,
     IDebug debug,
     ISkills skills,
     ISpells spells,
     IObject objects,
     IInventory inventory,
     Icommunication communication,
     IEquip equipment,
     IScore score,
     ICombat combat,
     ICache cache,
     ISocials socials,
     ICommandHandler commandHandler,
     ICore core,
     IMobFunctions mobFunctions,
     IHelp help,
     IMobScripts mobScripts,
     ICrafting crafting,
     ICooking cooking,
     IUtilSkills utilSkills,
     IPassiveSkills passiveSkills,
     IHealer healer
     )
 {
     _movement       = movement;
     _roomActions    = roomActions;
     _debug          = debug;
     _skills         = skills;
     _spells         = spells;
     _object         = objects;
     _inventory      = inventory;
     _communication  = communication;
     _equipment      = equipment;
     _score          = score;
     _combat         = combat;
     _cache          = cache;
     _socials        = socials;
     _commandHandler = commandHandler;
     _core           = core;
     _mobFunctions   = mobFunctions;
     _help           = help;
     _mobScripts     = mobScripts;
     _crafting       = crafting;
     _cooking        = cooking;
     _utilSkills     = utilSkills;
     _passiveSkills  = passiveSkills;
     _healer         = healer;
 }
예제 #6
0
        public void Healer_Constructor()
        {
            healer = new Healer(10);

            Assert.AreEqual(10, healer.CastPercent);
        }
예제 #7
0
 /// <summary>
 /// Accepts the healer.
 /// </summary>
 /// <param name="healer">The healer.</param>
 public abstract void AcceptHealer(IHealer healer);
예제 #8
0
 public AutoHealer(IHealer healer)
 {
     _healer = healer;
 }
예제 #9
0
 void GameEvents.IDoHeal.OnHeal(IHealer source, IHealable target, int amount)
 {
     Text.text = Localization.Instance.Get(LocalizationIds.Heal) + "+" + amount;
     StartCoroutine(Animate());
 }
예제 #10
0
 void IDoHeal.OnHeal(IHealer source, IHealable target, int amount) => CheckHealth(target as IRuntimeCharacter);
예제 #11
0
 int IHealable.TakeHeal(IHealer source, int amount) => Health.TakeHeal(source, amount);
예제 #12
0
 void OnDoneHeal(IHealer source, IHealable target, int amount) =>
 GameEvents.Instance.Notify <IDoHeal>(i => i.OnHeal(source, target, amount));
예제 #13
0
 public override void GetHeal(int value, IHealer got)
 {
     HealThis(value);
 }
예제 #14
0
 void GameEvents.IDoHeal.OnHeal(IHealer source, IHealable target, int amount) => TryApplyHeal(target, amount);
예제 #15
0
        //-------------------------------------------------------------------

        public int TakeHeal(IHealer source, int amount) => IgnoreOverHeal(amount);
예제 #16
0
 /// <summary>
 /// Accepts the healer.
 /// </summary>
 /// <param name="healer">The healer.</param>
 public override void AcceptHealer(IHealer healer) => healer.Heal(this);
예제 #17
0
 public int TakeHeal(IHealer source, int amount) => Health.TakeHeal(source, amount);