Exemplo n.º 1
0
    private static string GetExamineMessage(FighterAttributes attributes)
    {
        /////////////////////////////////////////////////
        //Local Variables

        StringBuilder builder = new StringBuilder();

        /////////////////////////////////////////////////

        builder.Append("This item changes the player's following attributes:");
        builder.Append(Environment.NewLine);

        if (attributes.BonusMaxHP > 0)
        {
            builder.AppendFormat("Bonus HP:  +{0}", attributes.BonusMaxHP);
            builder.Append(Environment.NewLine);
        }

        if (attributes.BonusPower > 0)
        {
            builder.AppendFormat("Bonus Power:  +{0}", attributes.BonusPower);
            builder.Append(Environment.NewLine);
        }

        if (attributes.BonusDefense > 0)
        {
            builder.AppendFormat("Bonus Defense:  +{0}", attributes.BonusDefense);
        }

        return(builder.ToString());
    }
Exemplo n.º 2
0
 void Start()
 {
     if (IsPlayer == true)
     {
         Attributes = ModelControl.GetPlayerAttributesFromModel();
     }
 }
Exemplo n.º 3
0
    private bool PlayerIsDead(FighterAttributes player)
    {
        if (player.CurrentHP <= 0)
        {
            return(true);
        }

        return(false);
    }
Exemplo n.º 4
0
    private void ResetBonuses(FighterAttributes fighter)
    {
        fighter.BonusMaxHP   = 0;
        fighter.BonusDefense = 0;
        fighter.BonusPower   = 0;

        if (fighter.CurrentHP > fighter.TotalMaxHP)
        {
            fighter.CurrentHP = fighter.TotalMaxHP;
        }
    }
Exemplo n.º 5
0
    private void UpdateBonus(FighterAttributes fighter)
    {
        ResetBonuses(fighter);

        foreach (AbstractItemAI item in fighter.Equipment.Values)
        {
            fighter.BonusMaxHP   += item.Attributes.BonusMaxHP;
            fighter.BonusDefense += item.Attributes.BonusDefense;
            fighter.BonusPower   += item.Attributes.BonusPower;
        }
    }
Exemplo n.º 6
0
    private void Equip(AbstractItemAI item, FighterAttributes fighter)
    {
        if (fighter.Equipment.ContainsKey(item.Slot) == true)
        {
            fighter.ItemUnequip(item.Slot);
        }

        fighter.Equipment.Add(item.Slot, item);

        fighter.UpdateBonusAttributes();
    }
Exemplo n.º 7
0
    public static void UpdatePlayerAttributesInModel(FighterAttributes attributes)
    {
        try
        {
            UpdateFighterAttributes(attributes);
        }

        catch (Exception ex)
        {
            StaticTrace.ExceptionLog(ex.Message, ex.StackTrace);
        }
    }
Exemplo n.º 8
0
    public void CheckForPlayerAttributes()
    {
        if (Attributes != null)
        {
            return;
        }

        if ((IsPlayer == true) && (Attributes == null))
        {
            Attributes = ModelControl.GetPlayerAttributesFromModel();
        }
    }
Exemplo n.º 9
0
    private static void UpdateFighterAttributes(FighterAttributes attributes)
    {
        /////////////////////////////////////////////////////
        //Local Variables

        MainAggregate model;

        /////////////////////////////////////////////////////

        model = FindAndReturnModel();

        model.PlayerAttributes = attributes;
    }
Exemplo n.º 10
0
    public void Start(EquipmentSlotState slot, FighterAttributes fighter)
    {
        try
        {
            Unequip(slot, fighter);
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
        }
    }
Exemplo n.º 11
0
    public void Start(FighterAttributes fighter)
    {
        try
        {
            UpdateBonus(fighter);
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
        }
    }
Exemplo n.º 12
0
    public void Start(AbstractItemAI item, FighterAttributes fighter)
    {
        try
        {
            Equip(item, fighter);
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
        }
    }
Exemplo n.º 13
0
    public static string Start(FighterAttributes attributes)
    {
        try
        {
            return(GetExamineMessage(attributes));
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
            return("Error in generating message.");
        }
    }
    private static FighterAttributes CreateAttributes()
    {
        //////////////////////////////////////////////////////////
        //Local Variables

        FighterAttributes attributes = new FighterAttributes();

        //////////////////////////////////////////////////////////

        attributes.BonusDefense = Dice.D6();

        attributes.BonusMaxHP = NewBonusHP.Start();

        return(attributes);
    }
Exemplo n.º 15
0
    private void Unequip(EquipmentSlotState slot, FighterAttributes fighter)
    {
        fighter.Equipment.Remove(slot);

        fighter.UpdateBonusAttributes();
    }