Esempio n. 1
0
        private static void doModifyAction(ActionPackage aPack)
        {
            switch (aPack.ActionDef.ModifyType)
            {
            case ModifyType.ATTRIBUTE:
                break;

            case ModifyType.ITEM:
                break;

            case ModifyType.KNOWLEDGE:
                break;

            case ModifyType.MECHANIC:
                break;

            case ModifyType.NONE:
                break;

            case ModifyType.SKILL:
                break;

            default:
                return;
            }
        }
Esempio n. 2
0
        private static void doWeaponDamage(ActionPackage aPack)
        {
            Item aWeapon = ActionUtils.getWeapon(aPack.Owner);
            Item dArmor  = ActionUtils.getArmor(aPack.Target);

            float aSkill = ActionUtils.getSkill(aPack.Owner, aPack.ActionDef.DamageDef.SkillName);
            float dSkill = ActionUtils.getSkill(aPack.Target, SkillName.AVOIDANCE);

            float aStat = ActionUtils.getStat(aPack.Owner, aPack.ActionDef.DamageDef.StatType);
            float dStat = ActionUtils.getStat(aPack.Target, ActionUtils.getOppositeStat(aPack.ActionDef.DamageDef.StatType));

            float aKnow = ActionUtils.getKnowledge(aPack.Owner, aPack.Target);
            float dKnow = ActionUtils.getKnowledge(aPack.Target, aPack.Owner);

            float aProb = ActionUtils.getStatProbability((float)aSkill, (float)aStat, aKnow, (float)aWeapon.Speed);
            float dProb = ActionUtils.getStatProbability((float)dSkill, (float)dStat, dKnow, (float)dArmor.Mobility);

            float hitProb = ActionUtils.getHitProbability(dProb, aProb, 1.75f, 0.15f);

            int damage = ActionUtils.getDamage(hitProb, aSkill, aStat, aWeapon.Lethality, dArmor.Mitigation,
                                               ActionUtils.getStat(aPack.Target, StatType.ENDURANCE));

            Position pos = ComponentMapper.get <Position> (aPack.Target);

            UtilFactory.createDirectDamage(damage,
                                           aPack.ActionDef.DamageDef.DamageType,
                                           aPack.Target,
                                           pos);

            Position newPos = new Position(pos.Pos + new Vector2(rand.Next(16) + 8, 0), Vector2.Zero);

            if (damage == 0)
            {
                UIFactory.createFloatingText("MISS",
                                             "DAMAGE",
                                             Color.White,
                                             500,
                                             newPos);
            }
            else
            {
                UIFactory.createFloatingText("" + damage,
                                             "DAMAGE",
                                             DamageUtils.getDamageColor(aPack.ActionDef.DamageDef.DamageType),
                                             500,
                                             newPos);
            }

            AwardUtils.attemptSkillAward(aPack.Owner, aPack.Target, aSkill, dSkill, aPack.ActionDef.DamageDef.SkillName, 1);
            AwardUtils.attemptStatAward(aPack.Owner, aPack.Target, aStat, dStat, aPack.ActionDef.DamageDef.StatType, 1);
            AwardUtils.attemptStatAward(aPack.Target, aPack.Owner,
                                        ActionUtils.getStat(aPack.Target, StatType.ENDURANCE), aStat,
                                        StatType.ENDURANCE, 1);
        }
Esempio n. 3
0
        private static void doStaticDamage(ActionPackage aPack)
        {
            int      dmg = rand.Next(aPack.ActionDef.DamageDef.Min, aPack.ActionDef.DamageDef.Max);
            Position pos = ComponentMapper.get <Position> (aPack.Target);

            UtilFactory.createDirectDamage(dmg,
                                           aPack.ActionDef.DamageDef.DamageType,
                                           aPack.Target,
                                           pos);

            Position newPos = new Position(pos.Pos + new Vector2(rand.Next(16) + 8, 0), Vector2.Zero);

            UIFactory.createFloatingText("" + dmg,
                                         "DAMAGE",
                                         DamageUtils.getDamageColor(aPack.ActionDef.DamageDef.DamageType),
                                         500,
                                         newPos);
        }
Esempio n. 4
0
        private static void doDamageAction(ActionPackage aPack)
        {
            Aggrivation aggro = ComponentMapper.get <Aggrivation> (aPack.Target);

            //check aggro and add if not present
            if (aggro != null)
            {
                if (!aggro.HateList.Contains(aPack.Owner))
                {
                    aggro.HateList.Add(aPack.Owner);
                }
            }

            switch (aPack.ActionDef.DamageDef.DamageBasis)
            {
            case DamageBasis.ATTRIBUTE:
                break;

            case DamageBasis.ITEM:
                break;

            case DamageBasis.NONE:
                break;

            case DamageBasis.SKILL:
                break;

            case DamageBasis.STATIC:
                doStaticDamage(aPack);
                break;

            case DamageBasis.WEAPON:
                doWeaponDamage(aPack);
                break;

            default:
                return;
            }
        }
Esempio n. 5
0
 private static void doInteractionAction(ActionPackage aPack)
 {
 }
Esempio n. 6
0
 private static void doDestroyAction(ActionPackage aPack)
 {
 }
Esempio n. 7
0
 private static void doCreateAction(ActionPackage aPack)
 {
 }