Exemple #1
0
 public void AddStatus(CharacterStatusEffects statusEffect, int duration)//adds new or replaces existing status effect
 {
     if (AllStatusEffects.ContainsKey(statusEffect))
     {
         AllStatusEffects.Remove(statusEffect);
     }
     AllStatusEffects.Add(statusEffect, duration);
 }
Exemple #2
0
 public void RemoveStatus(CharacterStatusEffects statusEffect)//removes status effect
 {
     AllStatusEffects.Remove(statusEffect);
 }
Exemple #3
0
 /// <summary>
 /// Handles when an ActiveStatusEffect is removed from this Character's StatusEffects.
 /// </summary>
 /// <param name="characterStatusEffects">The CharacterStatusEffects the event took place on.</param>
 /// <param name="activeStatusEffect">The ActiveStatusEffect that was removed.</param>
 protected virtual void StatusEffects_HandleOnRemove(CharacterStatusEffects characterStatusEffects,
                                                     EventArgs<ActiveStatusEffect> activeStatusEffect)
 {
     _updateModStats = true;
 }
Exemple #4
0
 /// <summary>
 /// adds buff or debuff
 /// </summary>
 /// <param name="statusEffect"></param>
 /// <param name="duration"></param>
 public void ReceiveStatusEffect(CharacterStatusEffects statusEffect, int duration)
 {
     StatusEffects.AddStatus(statusEffect, duration);
 }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Character"/> class.
        /// </summary>
        /// <param name="world">World that the character belongs to.</param>
        /// <param name="isPersistent">If the Character's state is persistent. If true, Load() MUST be called
        /// at some point during the Character's constructor!</param>
        protected Character(World world, bool isPersistent) : base(Vector2.Zero, Vector2.One)
        {
            IsAlive = false;
            _skillCaster = new CharacterSkillCaster(this);

            _world = world;
            _isPersistent = isPersistent;

            if (IsPersistent)
                _statusEffects = new PersistentCharacterStatusEffects(this);
            else
                _statusEffects = new NonPersistentCharacterStatusEffects(this);

            _statusEffects.Added -= StatusEffects_HandleOnAdd;
            _statusEffects.Added += StatusEffects_HandleOnAdd;
            _statusEffects.Removed -= StatusEffects_HandleOnRemove;
            _statusEffects.Removed += StatusEffects_HandleOnRemove;

            _baseStats = CreateStats(StatCollectionType.Base);
            _modStats = CreateStats(StatCollectionType.Modified);
            _spSync = CreateSPSynchronizer();
            _inventory = CreateInventory();
            _equipped = CreateEquipped();

            // Set up the listeners for when the stat collections change
            BaseStats.StatChanged -= BaseStatChangedHandler;
            BaseStats.StatChanged += BaseStatChangedHandler;
            ModStats.StatChanged -= ModStatChangedHandler;
            ModStats.StatChanged += ModStatChangedHandler;

            // Set up the listeners for when the equipped items change
            _equipped.Equipped -= EquippedHandler;
            _equipped.Equipped += EquippedHandler;
            _equipped.Unequipped -= UnequippedHandler;
            _equipped.Unequipped += UnequippedHandler;
        }