示例#1
0
    /*
    ============================================================================
    Condition functions
    ============================================================================
    */
    public void ApplyCondition(Combatant c)
    {
        if(DataHolder.BattleSystem().IsActiveTime())
        {
            c.timeBar = this.timebar;
            if(c.timeBar > DataHolder.BattleSystem().maxTimebar)
            {
                c.timeBar = DataHolder.BattleSystem().maxTimebar;
            }
        }

        for(int i=0; i<this.setStatus.Length; i++)
        {
            if(this.setStatus[i])
            {
                c.status[i].SetValue(this.status[i], true, false, false);
            }
        }

        for(int i=0; i<this.effect.Length; i++)
        {
            if(SkillEffect.ADD.Equals(this.effect[i]))
            {
                c.AddEffect(i, c);
            }
            else if(SkillEffect.REMOVE.Equals(this.effect[i]))
            {
                c.RemoveEffect(i);
            }
        }
    }
        private static ICombatant CreateCombatant(string pCombatantKey)
        {
            var data      = Database.Combatants[pCombatantKey];
            var combatant = new Combatant(data.Name, data.Description, data.ExpReward, data.Level, data.Body, data.Mind, data.Soul, data.Experience, data.SkillPoints);

            foreach (var itemKey in data.Drops.Keys)
            {
                var chance = Utilities.Random.NextDouble();
                if (!(data.Drops[itemKey] - chance > 0))
                {
                    continue;
                }

                var item = CreateItem(itemKey);
                combatant.AddItem(item);
            }

            foreach (var buffKey in data.Buffs.Keys)
            {
                var buff = CreateEffect(buffKey, data.Buffs[buffKey], -1);
                combatant.AddEffect(buff);
            }

            return(combatant);
        }
示例#3
0
 /*
 ============================================================================
 Utility functions
 ============================================================================
 */
 public void ApplyEffects(Combatant user, Combatant target)
 {
     for(int i=0; i<this.skillEffect.Length; i++)
     {
         if(SkillEffect.ADD.Equals(this.skillEffect[i]))
         {
             target.AddEffect(i, user);
         }
         else if(SkillEffect.REMOVE.Equals(this.skillEffect[i]))
         {
             target.RemoveEffect(i);
         }
     }
 }
示例#4
0
 public void CheckEndEffectChanges(Combatant target)
 {
     for(int i=0; i<this.effectChangeID.Length; i++)
     {
         if(SkillEffect.ADD.Equals(this.endEffectChanges[i]))
         {
             target.AddEffect(this.effectChangeID[i], target);
         }
         else if(SkillEffect.REMOVE.Equals(this.endEffectChanges[i]))
         {
             target.RemoveEffect(this.effectChangeID[i]);
         }
     }
 }