Exemple #1
0
    // Update is called once per frame
    //void FixedUpdate ()
    //   {
    //       if(RL_Bullet == enabled)
    //       {
    //           Invoke("Explosion", 1);
    //       }
    //}

    public void Explosion()
    {
        Vector3 explosionPosition = RL_Bullet.transform.position;

        Collider[] colliders = Physics.OverlapSphere(explosionPosition, radius);
        foreach (Collider hit in colliders)
        {
            Rigidbody   rigidbody = hit.GetComponent <Rigidbody>();
            ILiveEntity target    = rigidbody.gameObject.GetComponent <ILiveEntity>();

            if (rigidbody != null)
            {
                rigidbody.AddExplosionForce(power, explosionPosition, radius, upforce, ForceMode.Impulse);
            }

            if (target != null && !hit.GetComponent <Rigidbody>())
            {
                rigidbody.gameObject.GetComponent <NavMeshAgent>().enabled  = false;
                rigidbody.gameObject.GetComponent <Rigidbody>().isKinematic = false;
                target.TakeDamage(GlobalDamage.g_RocketAOEDamage, GlobalDamage.DamageTypes.DAMAGE_AOE_ROCKET_DAMAGE);
                this.gameObject.SetActive(false);
            }

            if (rigidbody.gameObject.tag == "Player")
            {
                Physics.IgnoreCollision(rigidbody.GetComponent <Collider>(), this.gameObject.GetComponent <Collider>());
            }
        }
    }
        TSpell F412_xxxx_MENUS_GetChampionSpellCastResult(ILiveEntity P795_i_ChampionIndex, IPowerSymbol powerSymbol)
        {
            int A1269_ui_RequiredSkillLevel;

            var L1270_ps_Champion = P795_i_ChampionIndex;

            IPowerSymbol L1268_i_PowerSymbolOrdinal = powerSymbol;
            int          L1273_ui_Experience        = rand.Next(8) + ((A1269_ui_RequiredSkillLevel = SkillLevel + L1268_i_PowerSymbolOrdinal.LevelOrdinal) << 4) + (((L1268_i_PowerSymbolOrdinal.LevelOrdinal - 1) * SkillLevel) << 3) + (A1269_ui_RequiredSkillLevel * A1269_ui_RequiredSkillLevel);

            var usedSkill           = P795_i_ChampionIndex.GetSkill(Skill);
            int A1267_ui_SkillLevel = usedSkill.SkillLevel;

            if (A1267_ui_SkillLevel < A1269_ui_RequiredSkillLevel)
            {
                int L1274_i_MissingSkillLevelCount = A1269_ui_RequiredSkillLevel - A1267_ui_SkillLevel;
                while (L1274_i_MissingSkillLevelCount-- > 0)
                {
                    if (rand.Next(128) > MathHelper.Min(L1270_ps_Champion.GetProperty(PropertyFactory <WisdomProperty> .Instance).Value + 15, 115))
                    {
                        usedSkill.AddExperience(L1273_ui_Experience >> (A1269_ui_RequiredSkillLevel - A1267_ui_SkillLevel));
                        F410_xxxx_MENUS_PrintSpellFailureMessage(L1270_ps_Champion, "C00_FAILURE_NEEDS_MORE_PRACTICE", Skill);
                        return(null);
                    }
                }
            }

            TSpell spell = ApplySpellEffect(L1270_ps_Champion, L1268_i_PowerSymbolOrdinal, A1267_ui_SkillLevel);

            usedSkill.AddExperience(L1273_ui_Experience);
            //TODO =>F330_szzz_CHAMPION_DisableAction(P795_i_ChampionIndex, Duration);
            return(spell);
        }
Exemple #3
0
        protected virtual bool FindEnemies()
        {
            if (Location == null)
            {
                hountingPath = null;
                return(false);
            }

            ILiveEntity enemy       = null;
            ITile       matchedTile = null;

            globalSearcher.StartSearch(Location.Tile, Location.Tile, Math.Max(DetectRange, SightRange), (tile, layer, bundle) =>
            {
                enemy = tile.LayoutManager.Entities.FirstOrDefault(e => RelationManager.IsEnemy(e.RelationManager.RelationToken));
                if (enemy != null)
                {
                    globalSearcher.StopSearch();
                    matchedTile = tile;
                }
            });
            if (enemy != null)
            {
                hountingPath = globalSearcher.GetShortestRoute(matchedTile);
                //$"{this} found enemies at {hountingPath.Last().GridPosition}".Dump();
                return(true);
            }
            else
            {
                hountingPath = null;
                return(false);
            }
        }
        public virtual bool AddChampoinToGroup(ILiveEntity entity)
        {
            var champion = entity as Champion;

            if (champion == null || partyGroup.Count == 4)
            {
                return(false);
            }

            var freeSpace = Small4GroupLayout.Instance.AllSpaces.Except(partyGroup.Select(ch => ch.Location?.Space).Where(x => x != null)).First();

            champion.Location     = new FourthSpaceRouteElement(freeSpace, Location.Tile);
            champion.MapDirection = MapDirection;
            partyGroup.Add(champion);
            champion.Died += (sender, deadChampion) =>
            {
                partyGroup.Remove(deadChampion);
                if (!partyGroup.Any())
                {
                    GameConsole.Instance.RunCommand(new ChampionCommand {
                        GameOver = true
                    });
                }
            };

            return(true);
        }
Exemple #5
0
        public override bool ApplyEffect(ILiveEntity entity)
        {
            int A1085_ui_AdjustedPotionPower = (Power / 25) + 8;

            F348_xxxx_INVENTORY_AdjustStatisticCurrentValue(entity, PropertyFactory <DextrityProperty> .Instance, A1085_ui_AdjustedPotionPower);
            return(Used = true);
        }
Exemple #6
0
        int F313_xxxx_CHAMPION_GetWoundDefense(ILiveEntity P652_i_ChampionIndex, WoundInfo P653_ui_WoundIndex)
        {
            int L0943_ui_ArmourShieldDefense = 0;

            var  L0946_ps_Champion       = P652_i_ChampionIndex;//&G407_s_Party.Champions[P652_i_ChampionIndex];
            bool L0944_B_UseSharpDefense = P653_ui_WoundIndex.UseSharpDefense;

            //if (L0944_B_UseSharpDefense = M07_GET(P653_ui_WoundIndex, MASK0x8000_USE_SHARP_DEFENSE))
            //{
            //    M09_CLEAR(P653_ui_WoundIndex, MASK0x8000_USE_SHARP_DEFENSE);
            //}

            foreach (var hand in L0946_ps_Champion.Body.BodyParts.Where(b => b.Type == ActionHandStorageType.Instance || b.Type == ReadyHandStorageType.Instance))
            {
                var armor = hand.Storage[0] as Cloth;
                if (armor != null && armor.ClothItemFactoryBase.IsShield)
                {
                    L0943_ui_ArmourShieldDefense += ((F312_xzzz_CHAMPION_GetStrength(L0946_ps_Champion, hand.Type) +
                                                      F143_mzzz_DUNGEON_GetArmourDefense(armor, L0944_B_UseSharpDefense)) *
                                                     //G050_auc_Graphic562_WoundDefenseFactor[P653_ui_WoundIndex.WoundIndex])
                                                     hand.InjuryMultipler)
                                                    >> ((hand.Type == P653_ui_WoundIndex.WoundIndex) ? 4 : 5);
                }
            }


            int A0942_i_WoundDefense = rand.Next((L0946_ps_Champion.GetProperty(PropertyFactory <VitalityProperty> .Instance).Value >> 3) + 1);

            if (L0944_B_UseSharpDefense)
            {
                A0942_i_WoundDefense >>= 1;
            }

            //TODO add additional defens to  L0946_ps_Champion.ActionDefense which should be DefenseProperty
            A0942_i_WoundDefense += L0946_ps_Champion.GetProperty(PropertyFactory <DefenseProperty> .Instance).Value /*L0946_ps_Champion.ActionDefense*/ +
                                    L0946_ps_Champion.GetProperty(PropertyFactory <ShieldDefenseProperty> .Instance).Value +
                                    L0943_ui_ArmourShieldDefense;

            //TODO should be done by armor modifier property
            //if ((P653_ui_WoundIndex > C01_SLOT_ACTION_HAND) &&
            //    (M12_TYPE(L0945_T_Thing = L0946_ps_Champion->Slots[P653_ui_WoundIndex]) == C06_THING_TYPE_ARMOUR))
            //{
            //    L0947_ps_ArmourInfo = (ARMOUR_INFO*)F156_afzz_DUNGEON_GetThingData(L0945_T_Thing);
            //    A0942_i_WoundDefense += F143_mzzz_DUNGEON_GetArmourDefense(&G239_as_Graphic559_ArmourInfo[((ARMOUR*)L0947_ps_ArmourInfo)->Type], L0944_B_UseSharpDefense);
            //}

            //if (M07_GET(L0946_ps_Champion->Wounds, 1 << P653_ui_WoundIndex))
            if (L0946_ps_Champion.Body.GetBodyStorage(P653_ui_WoundIndex.WoundIndex).IsWounded)
            {
                A0942_i_WoundDefense -= 8 + rand.Next(4);
            }

            //TODO party sleeping
            //if (G300_B_PartyIsSleeping)
            //{
            //    A0942_i_WoundDefense >>= 1;
            //}
            return(MathHelper.Clamp(A0942_i_WoundDefense >> 1, 0, 100));
        }
Exemple #7
0
        public static int F312_xzzz_CHAMPION_GetStrength(ILiveEntity attackProvider, IStorageType P651_i_SlotIndex)
        {
            int L0935_i_Strength = rand.Next(16) + attackProvider.GetProperty(PropertyFactory <StrengthProperty> .Instance).MaxValue;
            var L0938_T_Thing    = attackProvider.Body.GetStorage(P651_i_SlotIndex).Storage.First();
            //if ((A0936_ui_ObjectWeight = F140_yzzz_DUNGEON_GetObjectWeight(L0938_T_Thing)) <= (A0937_ui_OneSixteenthMaximumLoad = F309_awzz_CHAMPION_GetMaximumLoad(L0939_ps_Champion) >> 4))
            int A0936_ui_ObjectWeight            = (int)L0938_T_Thing.FactoryBase.Weight;
            int A0937_ui_OneSixteenthMaximumLoad = attackProvider.GetProperty(PropertyFactory <LoadProperty> .Instance).MaxValue >> 4;

            if (A0936_ui_ObjectWeight <= A0937_ui_OneSixteenthMaximumLoad)
            {
                L0935_i_Strength += A0936_ui_ObjectWeight - 12;
            }
            else
            {
                int L0941_i_LoadThreshold;
                if (A0936_ui_ObjectWeight <= (L0941_i_LoadThreshold = A0937_ui_OneSixteenthMaximumLoad + ((A0937_ui_OneSixteenthMaximumLoad - 12) >> 1)))
                {
                    L0935_i_Strength += (A0936_ui_ObjectWeight - A0937_ui_OneSixteenthMaximumLoad) >> 1;
                }
                else
                {
                    L0935_i_Strength -= (A0936_ui_ObjectWeight - L0941_i_LoadThreshold) << 1;
                }
            }
            //if (M12_TYPE(L0938_T_Thing) == C05_THING_TYPE_WEAPON)
            if (L0938_T_Thing is Weapon)
            {
                //#ifdef C01_COMPILE_DM10aEN_DM10bEN /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls */
                //                L0940_ps_WeaponInfo = &G238_as_Graphic559_WeaponInfo[((WEAPON*)G284_apuc_ThingData[C05_THING_TYPE_WEAPON])[M13_INDEX(L0938_T_Thing)].Type];
                //#endif
                //#ifdef C15_COMPILE_DM11EN_DM12EN_DM12GE_DM13aFR_DM13bFR_CSB20EN_CSB21EN /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls */
                var L0940_ps_WeaponInfo = L0938_T_Thing as Weapon;
                //#endif
                L0935_i_Strength += L0940_ps_WeaponInfo.FactoryType.Strength;
                int A0936_ui_SkillLevel = 0;
                var A0937_ui_Class      = L0940_ps_WeaponInfo.FactoryType.Class;
                if ((A0937_ui_Class == WeaponClass.C000_CLASS_SWING_WEAPON) || (A0937_ui_Class == WeaponClass.C002_CLASS_DAGGER_AND_AXES))
                {
                    A0936_ui_SkillLevel = attackProvider.GetSkill(SkillFactory <SwingSkill> .Instance).SkillLevel;
                }
                if ((A0937_ui_Class != WeaponClass.C000_CLASS_SWING_WEAPON) && (A0937_ui_Class < WeaponClass.C016_CLASS_FIRST_BOW))
                {
                    A0936_ui_SkillLevel += attackProvider.GetSkill(SkillFactory <ThrowSkill> .Instance).SkillLevel;
                }
                if ((A0937_ui_Class >= WeaponClass.C016_CLASS_FIRST_BOW) && (A0937_ui_Class < WeaponClass.C112_CLASS_FIRST_MAGIC_WEAPON))
                {
                    A0936_ui_SkillLevel += attackProvider.GetSkill(SkillFactory <ShootSkill> .Instance).SkillLevel;
                }
                L0935_i_Strength += A0936_ui_SkillLevel << 1;
            }
            L0935_i_Strength = F306_xxxx_CHAMPION_GetStaminaAdjustedValue(attackProvider.GetProperty(PropertyFactory <StaminaProperty> .Instance), /*L0939_ps_Champion,*/ L0935_i_Strength);
            //if (M07_GET(L0939_ps_Champion->Wounds, (P651_i_SlotIndex == C00_SLOT_READY_HAND) ? MASK0x0001_READY_HAND : MASK0x0002_ACTION_HAND))
            if (attackProvider.Body.GetBodyStorage(P651_i_SlotIndex).IsWounded)
            {
                L0935_i_Strength >>= 1;
            }
            //return F026_a003_MAIN_GetBoundedValue(0, L0935_i_Strength >> 1, 100);
            return(MathHelper.Clamp(L0935_i_Strength >> 1, 0, 100));
        }
Exemple #8
0
 public override bool ApplyEffect(ILiveEntity entity)
 {
     if (Used)
     {
         return(false);
     }
     F348_xxxx_INVENTORY_AdjustStatisticCurrentValue(entity, PropertyFactory <StrengthProperty> .Instance, Power / 35 + 5); /* Value between 5 and 12 */
     return(Used = true);
 }
Exemple #9
0
        public override bool ApplyEffect(ILiveEntity entity)
        {
            if (Used)
            {
                return(false);
            }

            entity.GetProperty(PropertyFactory <PoisonProperty> .Instance).Value = 0;
            return(Used = true);
        }
Exemple #10
0
        int F307_fzzz_CHAMPION_GetStatisticAdjustedAttack(ILiveEntity P642_ps_Champion, IPropertyFactory P643_ui_StatisticIndex, int P644_ui_Attack)
        {
            int L0927_i_Factor;

            if ((L0927_i_Factor = 170 - P642_ps_Champion.GetProperty(P643_ui_StatisticIndex).Value) < 16) //[C1_CURRENT]
            {
                /* BUG0_41 The Antifire and Antimagic statistics are completely ignored. The Vitality statistic is ignored against poison and to determine the probability of being wounded. Vitality is still used normally to compute the defense against wounds and the speed of health regeneration. A bug in the Megamax C compiler produces wrong machine code for this statement. It always returns 0 for the current statistic value so that L0927_i_Factor = 170 in all cases */
                return(P644_ui_Attack >> 3);
            }
            return(F030_aaaW_MAIN_GetScaledProduct(P644_ui_Attack, 7, L0927_i_Factor));
        }
        public override bool ApplyEffect(ILiveEntity entity)
        {
            if (Used)
            {
                return(false);
            }
            var water = entity.GetProperty(PropertyFactory <WaterProperty> .Instance);

            water.Value += 1600;
            return(Used = true);
        }
Exemple #12
0
        int F192_ayzz_GROUP_GetResistanceAdjustedPoisonAttack(ILiveEntity creature, int P381_i_PoisonAttack)
        {
            int L0390_i_PoisonResistance = 0;

            L0390_i_PoisonResistance = creature.GetProperty(PropertyFactory <AntiPoisonProperty> .Instance).Value;
            if (P381_i_PoisonAttack == 0 || L0390_i_PoisonResistance == 15)//_IMMUNE_TO_POISON if 15
            {
                return(0);
            }
            return(((P381_i_PoisonAttack + rand.Next(4)) << 3) / ++L0390_i_PoisonResistance);
        }
Exemple #13
0
        protected override int ModifyAttackyByResistance(int attack, ILiveEntity entity)
        {
            int L0390_i_PoisonResistance = 0;

            L0390_i_PoisonResistance = entity.GetProperty(PropertyFactory <AntiPoisonProperty> .Instance).Value;
            if (attack == 0 || L0390_i_PoisonResistance == 15)//_IMMUNE_TO_POISON if 15
            {
                return(0);
            }
            return(((attack + rand.Next(4)) << 3) / ++L0390_i_PoisonResistance);
        }
Exemple #14
0
        public bool ApplyEffect(ILiveEntity entity)
        {
            if (Used)
            {
                return(false);
            }

            var food = entity.GetProperty(PropertyFactory <FoodProperty> .Instance);

            food.Value += FoodFactory.FoodValue;
            return(Used = true);
        }
Exemple #15
0
        public override bool ApplyEffect(ILiveEntity entity)
        {
            if (Used)
            {
                return(false);
            }
            int L1086_ui_Counter = ((511 - Power) / (32 + (Power + 1) / 8)) >> 1;
            var stamina          = entity.GetProperty(PropertyFactory <StaminaProperty> .Instance);

            stamina.Value += stamina.MaxValue / L1086_ui_Counter;
            return(Used = true);
        }
Exemple #16
0
        public static bool F308_vzzz_CHAMPION_IsLucky(ILiveEntity entity, int P646_ui_Percentage)
        {
            if (rand.Next(2) != 0 && (rand.Next(100) > P646_ui_Percentage))
            {
                return(true);
            }

            var  luckProperty     = entity.GetProperty(PropertyFactory <LuckProperty> .Instance);
            bool AP646_ui_IsLucky = rand.Next(luckProperty.MaxValue) > P646_ui_Percentage;

            luckProperty.BaseValue += AP646_ui_IsLucky ? -2 : 2;
            return(AP646_ui_IsLucky);
        }
Exemple #17
0
        public override bool ApplyEffect(ILiveEntity entity)
        {
            if (Used)
            {
                return(false);
            }


            int L1086_ui_Counter = ((511 - Power) / (32 + (Power + 1) / 8)) >> 1;
            int A1088_ui_HealWoundIterationCount = MathHelper.Max(1, Power / 42);

            var health = entity.GetProperty(PropertyFactory <HealthProperty> .Instance);

            health.Value += health.MaxValue / L1086_ui_Counter;

            var bodyParts = entity.Body.BodyParts.ToArray();

            if (bodyParts.Any(x => x.IsWounded))
            { /* If the champion is wounded */
                L1086_ui_Counter = 10;
                do
                {
                    bool atLeasOneHealed = false;
                    int  A1085_ui_Counter;
                    for (A1085_ui_Counter = 0; A1085_ui_Counter < A1088_ui_HealWoundIterationCount; A1085_ui_Counter++)
                    {
                        //flowing code should be similar to => // L1083_ps_Champion->Wounds &= M06_RANDOM(65536);
                        var maxHealCount = rand.Next(bodyParts.Length) + 1;
                        var healIndices  = Enumerable.Range(0, maxHealCount)
                                           .Select(x => rand.Next(bodyParts.Length))
                                           .ToArray();

                        atLeasOneHealed = false;
                        foreach (int index in healIndices)
                        {
                            var part = bodyParts[index];
                            atLeasOneHealed |= part.IsWounded;
                            part.IsWounded   = false;
                        }
                    }
                    A1088_ui_HealWoundIterationCount = 1;

                    if (atLeasOneHealed)
                    {
                        break;
                    }
                } while (--L1086_ui_Counter >= 0); /* Loop until at least one wound is healed or there are no more heal iterations */
            }
            return(Used = true);
        }
Exemple #18
0
        public bool ApplyEffect(ILiveEntity entity)
        {
            if (ChargeCount-- > 0)
            {
                var water = entity.GetProperty(PropertyFactory <WaterProperty> .Instance);
                water.Value += WaterFactory.WaterValuePerCharge;

                return(true);
            }
            else
            {
                return(false);
            }
        }
        void F193_xxxx_GROUP_StealFromChampion(/*group P382_ps_Group,*/ ILiveEntity P383_i_ChampionIndex)
        {
            //int L0391_i_Percentage;
            //int L0392_i_StealFromSlotIndex;
            //int L0393_ui_Counter;
            //THING L0394_T_Thing;
            //Champion L0395_ps_Champion;
            //bool L0396_B_ObjectStolen;
            //char G394_auc_StealFromSlotIndices[8]
            //; /* Initialized with 0 bytes by C loader */


            //L0396_B_ObjectStolen = false;
            //L0391_i_Percentage = 100 - L0395_ps_Champion.GetProperty(PropertyFactory<DextrityProperty>.Instance).Value; //  F311_wzzz_CHAMPION_GetDexterity(L0395_ps_Champion = &G407_s_Party.Champions[P383_i_ChampionIndex]);
            //L0393_ui_Counter = random.Next(8);
            //while ((L0391_i_Percentage > 0) && 0 == L0395_ps_Champion.GetProperty(PropertyFactory<LuckProperty>.Instance).Value)
            ////!F308_vzzz_CHAMPION_IsLucky(L0395_ps_Champion, L0391_i_Percentage))
            //{
            //    if ((L0392_i_StealFromSlotIndex = G394_auc_StealFromSlotIndices[L0393_ui_Counter]) == C13_SLOT_BACKPACK_LINE1_1)
            //    {
            //        L0392_i_StealFromSlotIndex += random.Next(17); /* Select a random slot in the backpack */
            //    }
            //    if (((L0394_T_Thing = L0395_ps_Champion->Slots[L0392_i_StealFromSlotIndex]) != C0xFFFF_THING_NONE))
            //    {
            //        L0396_B_ObjectStolen = true;
            //        L0394_T_Thing = F300_aozz_CHAMPION_GetObjectRemovedFromSlot(P383_i_ChampionIndex, L0392_i_StealFromSlotIndex);
            //        if (P382_ps_Group->Slot == C0xFFFE_THING_ENDOFLIST)
            //        {
            //            P382_ps_Group->Slot = L0394_T_Thing; /* BUG0_12 An object is cloned and appears at two different locations in the dungeon and/or inventory. The game may crash when interacting with this object. If a Giggler with no possessions steals an object that was previously in a chest and was not the last object in the chest then the objects that followed it are cloned. In the chest, the object is part of a linked list of objects that is not reset when the object is removed from the chest and placed in the inventory (but not in the dungeon), nor when it is stolen and added as the first Giggler possession. If the Giggler already has a possession before stealing the object then this does not create a cloned object.
            //                    The following statement is missing: L0394_T_Thing->Next = C0xFFFE_THING_ENDOFLIST;
            //                    This creates cloned things if L0394_T_Thing->Next is not C0xFFFE_THING_ENDOFLIST which is the case when the object comes from a chest in which it was not the last object */
            //        }
            //        else
            //        {
            //            F163_amzz_DUNGEON_LinkThingToList(L0394_T_Thing, P382_ps_Group->Slot, CM1_MAPX_NOT_ON_A_SQUARE, 0);
            //        }
            //        F292_arzz_CHAMPION_DrawState(P383_i_ChampionIndex);
            //    }
            //    ++L0393_ui_Counter;
            //    L0393_ui_Counter &= 0x0007;
            //    L0391_i_Percentage -= 20;
            //}

            //if (0 == random.Next(8) || (L0396_B_ObjectStolen && random.Next(2) > 0))
            //{
            //    G375_ps_ActiveGroups[P382_ps_Group->ActiveGroupIndex].DelayFleeingFromTarget = random.Next(64) + 20;
            //    P382_ps_Group->Behavior = C5_BEHAVIOR_FLEE;
            //}
        }
Exemple #20
0
    void OnCollisionEnter(Collision _other)
    {
        ILiveEntity target = _other.gameObject.GetComponent <ILiveEntity> ();

        if (target != null)
        {
            target.TakeDamage(GlobalDamage.g_HMGDamage, GlobalDamage.DamageTypes.DAMAGE_BALLISTIC_SMALL);
            this.gameObject.SetActive(false);
        }

        if (_other.gameObject.tag == "Player")
        {
            Physics.IgnoreCollision(_other.collider, this.gameObject.GetComponent <Collider>());
        }
    }
        public IAction CreateAction(ILiveEntity actionProvider)
        {
            if (actionProvider == null)
            {
                throw new ArgumentNullException();
            }

            if (MinimumSkillLevel <= actionProvider.GetSkill(FightAction.SkillIndex).SkillLevel)
            {
                return(FightAction.CreateAction(actionProvider));
            }
            else
            {
                return(null);
            }
        }
Exemple #22
0
        protected override OpenDoorSpell ApplySpellEffect(ILiveEntity entity, IPowerSymbol powerSymbol, int skillLevel)
        {
            skillLevel <<= 1;
            int kineticEnergy = MathHelper.Clamp(21, (powerSymbol.LevelOrdinal + 2) * (4 + (skillLevel << 1)), 255);
            var values        = F327_kzzz_CHAMPION_IsProjectileSpellCast(entity, kineticEnergy, 0);

            if (values != null)
            {
                var val = values.Value;
                return(new OpenDoorSpell(val.KineticEnergy, val.StepEnergy));
            }
            else
            {
                return(null);
            }
        }
        protected override ExplosionProjectilSpell <TImpact> ApplySpellEffect(ILiveEntity entity, IPowerSymbol powerSymbol, int skillLevel)
        {
            int kineticEnergy = MathHelper.Clamp(21, (powerSymbol.LevelOrdinal + 2) * (4 + (skillLevel << 1)), 255);
            var values        = F327_kzzz_CHAMPION_IsProjectileSpellCast(entity, kineticEnergy, 0);

            if (values != null)
            {
                var val = values.Value;
                var res = new ExplosionProjectilSpell <TImpact>(val.KineticEnergy, val.StepEnergy, val.Attack);
                res.Projectile.Renderer = RenderersSource.GetProjectileSpellRenderer(res.Projectile, Texture);
                return(res);
            }
            else
            {
                return(null);
            }
        }
        protected override int ModifyAttackyByResistance(int attack, ILiveEntity entity)
        {
            var antiFire = entity.GetProperty(PropertyFactory <AntiFireProperty> .Instance);

            if (antiFire.Value == 15)
            {
                return(0);
            }

            if (entity.GetProperty(PropertyFactory <NonMaterialProperty> .Instance).Value == 1)
            {
                attack >>= 2;
            }

            attack -= rand.Next((antiFire.Value << 1) + 1);
            return(attack);
        }
Exemple #25
0
        protected virtual bool F207_xxxx_GROUP_IsCreatureAttacking(ILiveEntity enemy)
        {
            CreatureFactory L0441_ps_CreatureInfo = AttackProvider.Factory;

            int A0440_i_Damage = F230_ezzz_GROUP_GetChampionDamage(enemy) + 1;

            //Champion L0442_ps_Champion = enemy;
            //if (A0440_i_Damage > L0442_ps_Champion->MaximumDamageReceived)
            //{
            //    L0442_ps_Champion->MaximumDamageReceived = A0440_i_Damage;
            //    L0442_ps_Champion->DirectionMaximumDamageReceived = M18_OPPOSITE(L0438_ui_PrimaryDirectionToParty);
            //}
            //if (A0440_i_AttackSoundOrdinal = L0441_ps_CreatureInfo->AttackSoundOrdinal)
            //{
            //    //TODO sound F064_aadz_SOUND_RequestPlay_COPYPROTECTIOND(G244_auc_Graphic559_CreatureAttackSounds[--A0440_i_AttackSoundOrdinal], P422_i_MapX, P423_i_MapY, C01_MODE_PLAY_IF_PRIORITIZED);
            //}
            return(true);
        }
Exemple #26
0
        public override bool ApplyEffect(ILiveEntity entity)
        {
            if (Used)
            {
                return(false);
            }

            int A1085_ui_AdjustedPotionPower = (Power / 25) + 8;
            var manaProperty  = entity.GetProperty(PropertyFactory <ManaProperty> .Instance);
            int A1088_ui_Mana = MathHelper.Min(900, (manaProperty.Value + A1085_ui_AdjustedPotionPower) + (A1085_ui_AdjustedPotionPower - 8));

            //bounds check should do property itself
            //if (A1088_ui_Mana > L1083_ps_Champion->MaximumMana)
            //{
            //    A1088_ui_Mana -= (A1088_ui_Mana - MathHelper.Max(L1083_ps_Champion->CurrentMana, L1083_ps_Champion->MaximumMana)) >> 1;
            //}
            manaProperty.Value = A1088_ui_Mana;
            return(Used = true);
        }
        public async void Run(ILiveEntity caster, MapDirection direction)
        {
            var light = caster.GetProperty(PropertyFactory <MagicalLightProperty> .Instance);

            light.Value += Factory.LightPowerToLightAmount[lightPower];

            lightPower *= -1;

            while (true)
            {
                await Task.Delay(duration);

                if (lightPower == 0)
                {
                    return;
                }

                bool negative = lightPower < 0;
                if (negative)
                {
                    lightPower *= -1;
                }

                int weakerLightPower    = lightPower - 1;
                int A0674_i_LightAmount = Factory.LightPowerToLightAmount[lightPower] - Factory.LightPowerToLightAmount[weakerLightPower];
                if (negative)
                {
                    A0674_i_LightAmount = -A0674_i_LightAmount;
                    weakerLightPower   *= -1;
                }

                light.Value += A0674_i_LightAmount;
                if (weakerLightPower != 0)
                {
                    lightPower = weakerLightPower;
                    duration   = 4000 / 6;
                }
                else
                {
                    break;
                }
            }
        }
Exemple #28
0
        protected ProjectileProperties?F327_kzzz_CHAMPION_IsProjectileSpellCast(ILiveEntity L0992_ps_Champion, int P681_i_KineticEnergy, int P682_ui_RequiredManaAmount)
        {
            var mana = L0992_ps_Champion.GetProperty(PropertyFactory <ManaProperty> .Instance);

            if (mana.Value < P682_ui_RequiredManaAmount)
            {
                return(null);
            }

            mana.Value -= P682_ui_RequiredManaAmount;


            //M08_SET(L0992_ps_Champion->Attributes, MASK0x0100_STATISTICS);
            int L0991_i_StepEnergy = 10 - MathHelper.Min(8, mana.MaxValue >> 3);

            if (P681_i_KineticEnergy < (L0991_i_StepEnergy << 2))
            {
                P681_i_KineticEnergy += 3;
                L0991_i_StepEnergy--;
            }
            return(new ProjectileProperties(P681_i_KineticEnergy, L0991_i_StepEnergy, 90));
        }
Exemple #29
0
    void OnCollisionEnter(Collision col)
    {
        ILiveEntity target = col.gameObject.GetComponent <ILiveEntity>();

        if (target != null)
        {
            target.TakeDamage(GlobalDamage.g_RocketDirectDamage, GlobalDamage.DamageTypes.DAMAGE_ROCKET);
            //this.gameObject.SetActive(false);
        }

        if (col.gameObject.tag == "Player")
        {
            Physics.IgnoreCollision(col.collider, this.gameObject.GetComponent <Collider>());
        }

        //TODO: fix rocket detonating on flamethrowers
        ObjectPooler.Instance.SpawnFromPool("RL_Explosion", transform.position, gameObject.transform.rotation);
        var explosionScript = this.gameObject.GetComponent <RL_Explosion>();

        explosionScript.Explosion();
        this.gameObject.SetActive(false);
    }
Exemple #30
0
        public override bool ApplyEffect(ILiveEntity entity)
        {
            if (Used)
            {
                return(false);
            }
            int A1085_ui_AdjustedPotionPower = (Power / 25) + 8;

            A1085_ui_AdjustedPotionPower += A1085_ui_AdjustedPotionPower >> 1;

            var shieldDefense = entity.GetProperty(PropertyFactory <ShieldDefenseProperty> .Instance);

            if (shieldDefense.Value > 50)
            {
                A1085_ui_AdjustedPotionPower >>= 2;
            }

            shieldDefense.Value += A1085_ui_AdjustedPotionPower;
            DisableEffectAsync(shieldDefense, (A1085_ui_AdjustedPotionPower * A1085_ui_AdjustedPotionPower) * 1000 / 6, -A1085_ui_AdjustedPotionPower);

            return(Used = true);
        }