Ejemplo n.º 1
0
        public MainWindow()
        {
            GlobalItems              = new List <PhysObj>();
            CharParty                = new List <Character>();
            CharParties              = new List <CharParty>();
            MonsterParty             = new List <Monster>();
            MonsterParties           = new List <MonsterParty>();
            Party                    = new List <Fant_Entity>();
            Parties                  = new List <Party>();
            entitySelected           = new Fant_Entity();
            characterExample         = new Character();
            entitySelected.Name      = "Default";
            entitySelected.IsAlive   = true;
            entitySelected.HitOn20   = 10;
            entitySelected.MaxHp     = 1;
            entitySelected.PartyName = "Default";

            // sqlEntitySelected = new Fant_Entity();
            // sqlEntitySelected.Name = "Default";
            // sqlEntitySelected.PartyName= "Default";
            // sqlEntitySelected.Lvl = 1;


            InitializeComponent();
        }
Ejemplo n.º 2
0
        private string ThisEntityToXMLString(Fant_Entity fant_Entity)
        {
            XmlSerializer _XMLformatter = new XmlSerializer(fant_Entity.GetType());
            StringWriter  stringwriter  = new StringWriter();
            string        stringXML     = "";

            _XMLformatter.Serialize(stringwriter, fant_Entity);
            stringXML = stringwriter.ToString();
            return(stringXML);
        }
Ejemplo n.º 3
0
        public virtual int MeleeAttack(Fant_Entity Defender)    //this should be currently overridden for both monsters and charac
        {
            RollingDie twentyside = new RollingDie(20, 1);
            int        tohit;
            int        attRoll = twentyside.Roll();

            if (Defender.AC < hitOn20)
            {
                tohit = 20 - (hitOn20 - Defender.AC);
            }
            else if (Defender.AC >= (hitOn20 + 5))
            {
                tohit = 20 + ((Defender.AC - hitOn20) - 5);
            }
            else
            {
                tohit = 20;
            }

            if (attRoll >= tohit)
            {
                int damage = 8;                       //placeholder for damage
                Defender.Hp -= damage;
            }

            // same as  Defender.Hp = Defender.Hp - damage;
            if (Defender.Hp <= 0)                                  // will change this to proper level for unconsciouness
            {
                // WriteLine($"{Defender.Name} has died.");
                Defender.IsAlive = false;

                return(Defender.Hp);
            }

            else
            {// WriteLine($"{name} missed!");
                return(Defender.Hp);
            }
        }
Ejemplo n.º 4
0
        public int characterAttackCalc(Fant_Entity Defender)
        {
            RollingDie twentyside = new RollingDie(20, 1);
            int        tohit;
            int        attRoll = twentyside.Roll();

            if (Defender.AC < hitOn20)
            {
                tohit = 20 - (hitOn20 - Defender.AC);
            }
            else if (Defender.AC >= (hitOn20 + 5))
            {
                tohit = 20 + ((Defender.AC - hitOn20) - 5);
            }
            else
            {
                tohit = 20;
            }

            if (attRoll >= tohit)
            {
                int    damage      = 0;
                string damagerange = "";
                foreach (PhysObj CheckObject in this.Inventory)
                {
                    if (CheckObject.IsEquipped == true && CheckObject.ObjType is "Weapon")     // this was just a rough first concept check
                    {
                        damagerange = CheckObject.Damage;                                      // need to allow for two handed etc etc etc
                        (int i1, int i2, int i3) = RollingDie.Diecheck(damagerange);
                        RollingDie thisRoll = new RollingDie(i1, i2, i3);
                        damage = thisRoll.Roll();
                    }
                }
                int DamStrAdj = 0;                    // + str adj to damage
                if (this.Str <= 5)
                {
                    DamStrAdj = -1;
                }
                else if (this.Str == 16 || this.Str == 17)
                {
                    DamStrAdj = 1;
                }
                else if (this.Str >= 18)
                {
                    DamStrAdj = 2;
                }

                damage = (damage + DamStrAdj);
                if (damage < 1)
                {
                    damage = 1;
                }



                Defender.Hp -= damage;                          // same as  Defender.Hp = Defender.Hp - damage;
                if (Defender.Hp <= 0)                           // will change this to proper level for unconsciouness
                {
                    // WriteLine($"{Defender.Name} has died.");
                    Defender.IsAlive = false;
                }
                return(Defender.Hp);
            }
            else
            {// WriteLine($"{name} missed!");
                return(Defender.Hp);
            }
        }
Ejemplo n.º 5
0
 public override int MeleeAttack(Fant_Entity Defender)
 {
     return(Defender.Hp = characterAttackCalc(Defender));
 }
Ejemplo n.º 6
0
        public int monsterAttackCalc(Fant_Entity Defender)
        {
            int cumDamage = 0;

            RollingDie twentyside = new RollingDie(20, 1);
            int        tohit;

            if (Defender.AC < hitOn20)
            {
                tohit = 20 - (hitOn20 - Defender.AC);
            }
            else if (Defender.AC >= (hitOn20 + 5))
            {
                tohit = 20 + ((Defender.AC - hitOn20) - 5);
            }
            else
            {
                tohit = 20;
            }

            int attRoll = twentyside.Roll();

            if (attRoll >= tohit)
            {
                string dieroll = this.damPerAtt1;
                (int i1, int i2, int i3) = RollingDie.Diecheck(dieroll);
                if (i1 != 0)
                {
                    RollingDie thisRoll = new RollingDie(i1, i2, i3);
                    int        damage   = thisRoll.Roll();
                    cumDamage += damage;
                }
            }
            if (this.NoOfAtt >= 2)
            {
                int attRoll2 = twentyside.Roll();
                if (attRoll2 >= tohit)
                {
                    string dieroll2 = this.damPerAtt2;
                    (int i1, int i2, int i3) = RollingDie.Diecheck(dieroll2);
                    if (i1 != 0)
                    {
                        RollingDie thisRoll = new RollingDie(i1, i2, i3);
                        int        damage2  = thisRoll.Roll();
                        cumDamage += damage2;
                    }
                }
            }
            if (this.NoOfAtt >= 3)
            {
                int attRoll3 = twentyside.Roll();
                if (attRoll3 >= tohit)
                {
                    string dieroll3 = this.damPerAtt3;
                    (int i1, int i2, int i3) = RollingDie.Diecheck(dieroll3);
                    if (i1 != 0)
                    {
                        RollingDie thisRoll = new RollingDie(i1, i2, i3);
                        int        damage3  = thisRoll.Roll();
                        cumDamage += damage3;
                    }
                }
            }
            Defender.Hp -= cumDamage;                          // same as  Defender.Hp = Defender.Hp - damage;

            return(Defender.Hp);
        }