private bool checkCost(Gladiator gladiator, Item item, SlotStuff slotStuff)
        {
            uint newCost = gladiator.stuff.getCostAllStuff() + item.cost - gladiator.stuff.getCostItem(slotStuff);
            //		Le total actuel de l'équipement + coût nouveau item - l'item qui sera ramplacé

            if (newCost > MAX_COST_STUFF) {
                return false;
            }

            return true;
        }
예제 #2
0
파일: Duel.cs 프로젝트: Eraac/TP-Gladiator
        private Hit hit(Gladiator attacker, Gladiator defenser)
        {
            List<SlotStuff> hits = attacker.getSlotByStats(TypeStats.CHANCE_HIT);
            List<SlotStuff> parries = defenser.getSlotByStats(TypeStats.CHANCE_PARRY);

            foreach(SlotStuff slotForHit in hits)
            {
                uint chanceHit = attacker.chanceHit(slotForHit);

                if (this.diceRool(chanceHit))
                {
                    Console.WriteLine(attacker.name + " réussi son attaque contre " + defenser.name);
                    // Le filet ne peut pas être parré
                    if (attacker.isFilet(slotForHit))
                    {
                        Console.WriteLine(attacker.name + " lance le filet et réussi");
                        return Hit.TRAPPED;
                    }

                    foreach (SlotStuff slotForParry in parries)
                    {
                        uint chanceParry = defenser.chanceParry(slotForParry);

                        if (this.diceRool(chanceParry))
                        {
                            Console.WriteLine(defenser.name + " rate la parade");
                            return Hit.TOUCH;
                        }
                    }

                    Console.WriteLine(defenser.name + " réussi la parade");
                }
            }

            Console.WriteLine(attacker.name + " rate son coup");
            return Hit.NOPE;
        }
예제 #3
0
파일: Team.cs 프로젝트: Eraac/TP-Gladiator
        public bool addGladiator(Gladiator gladiator)
        {
            int nbGladiator = this._gladiators.Count;

            if (nbGladiator >= NB_GLADIATOR_MAX_PER_TEAM)
            {
                return false;
            }

            this._gladiators.Add(gladiator);

            return true;
        }
 public bool canEquip(Gladiator gladiator, Item item, SlotStuff slotStuff)
 {
     return this.checkSlot(item, slotStuff) && this.checkCost(gladiator, item, slotStuff);
 }
예제 #5
0
파일: Duel.cs 프로젝트: Eraac/TP-Gladiator
 public Duel(Gladiator gladiatorA, Gladiator gladiatorB)
 {
     this._gladiatorA = gladiatorA;
     this._gladiatorB = gladiatorB;
 }
예제 #6
0
파일: Duel.cs 프로젝트: Eraac/TP-Gladiator
        private void setEffect(Hit hit, Gladiator gladiator)
        {
            switch(hit)
            {
                case Hit.TRAPPED:
                    gladiator.debuff = new Trapped();
                    break;

                case Hit.TOUCH:
                    gladiator.debuff = new Dead();
                    break;
            }
        }