public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (m_Player != null)
            {
                if (m_Player != player)
                {
                    from.SendMessage("That item may only be used by " + m_Player.Name + ".");
                    return;
                }
            }

            UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadUpgradePoints, 1, true);
            player.SendSound(UOACZSystem.earnCorruptionSound);

            UOACZSystem.RefreshAllGumps(player);

            Delete();
        }
示例#2
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            if (!UOACZPersistance.Enabled)
            {
                from.SendMessage("UOACZ system currently disabled.");
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (m_Player != null)
            {
                Account ownerAccount  = m_Player.Account as Account;
                Account playerAccount = player.Account as Account;

                if (ownerAccount != null && playerAccount != null && ownerAccount != playerAccount)
                {
                    from.SendMessage("That item may only be used by " + m_Player.Name + ".");
                    return;
                }
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.SurvivalPoints, 1, true);
            player.SendSound(UOACZSystem.earnSurvivalSound);

            UOACZSystem.RefreshAllGumps(player);

            Delete();
        }
示例#3
0
        public void CheckScore(PlayerMobile player, int amount)
        {
            if (player == null || amount == 0)
            {
                return;
            }

            int score     = (int)(Math.Floor((double)amount / (double)UOACZSystem.HumanBonesPerScore));
            int remainder = amount % UOACZSystem.HumanBonesPerScore;

            if (Utility.RandomDouble() <= ((double)remainder / (double)UOACZSystem.HumanBonesPerScore))
            {
                score++;
            }

            if (score > 0)
            {
                UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.HumanScore, score, true);
            }
        }
示例#4
0
        public static void EventSink_AggressiveAction(AggressiveActionEventArgs e)
        {
            PlayerMobile pm_From   = e.Aggressor as PlayerMobile;
            PlayerMobile pm_Target = e.Aggressed as PlayerMobile;

            BaseCreature bc_Target = e.Aggressed as BaseCreature;

            //UOACZ
            if (pm_From != null && bc_Target != null)
            {
                if (pm_From.IsUOACZHuman && bc_Target is UOACZBaseHuman)
                {
                    if (!CheckAggressions(pm_From, bc_Target) && pm_From.AccessLevel == AccessLevel.Player)
                    {
                        UOACZSystem.ChangeStat(pm_From, UOACZSystem.UOACZStatType.Honor, UOACZSystem.HumanAttackCivilianHonorLoss, true);
                    }
                }
            }

            if (pm_From == null || pm_Target == null)
            {
                return;
            }

            if (!CheckAggressions(pm_From, pm_Target) && pm_From.AccessLevel == AccessLevel.Player)
            {
                pm_From.LocalOverheadMessage(MessageType.Regular, Hue, true, String.Format(AggressorFormat, pm_Target.Name));
                pm_Target.LocalOverheadMessage(MessageType.Regular, Hue, true, String.Format(AggressedFormat, pm_From.Name));

                //UOACZ
                if (pm_From.IsUOACZHuman && pm_Target.IsUOACZHuman)
                {
                    if (Notoriety.Compute(pm_From, pm_Target) == Notoriety.Innocent)
                    {
                        UOACZSystem.ChangeStat(pm_From, UOACZSystem.UOACZStatType.Honor, UOACZSystem.HumanAttackPlayerHonorLoss, true);
                    }
                }
            }
        }
示例#5
0
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);

            Dictionary <PlayerMobile, int> m_PlayerDamageDealt = new Dictionary <PlayerMobile, int>();
            List <PlayerMobile>            m_PotentialPlayers  = new List <PlayerMobile>();

            int scoreValue = 1;

            double rewardChance          = 0.0;
            double corruptionStoneChance = 0.0;
            double upgradeTokenChance    = 0.0;

            #region Upgrade Chances

            switch (DifficultyValue)
            {
            //Civilian
            case 1:
                scoreValue = 1;

                rewardChance          = .8;
                corruptionStoneChance = .6;
                upgradeTokenChance    = .4;
                break;

            case 2:
                scoreValue = 2;

                rewardChance          = .8;
                corruptionStoneChance = .6;
                upgradeTokenChance    = .4;
                break;

            //Militia
            case 3:
                scoreValue = 3;

                rewardChance          = 1.0;
                corruptionStoneChance = .8;
                upgradeTokenChance    = .6;
                break;

            case 4:
                scoreValue = 4;

                rewardChance          = 1.0;
                corruptionStoneChance = .8;
                upgradeTokenChance    = .6;
                break;

            //Elite
            case 5:
                scoreValue = 5;

                rewardChance          = 1.2;
                corruptionStoneChance = 1.0;
                upgradeTokenChance    = .8;
                break;

            case 6:
                scoreValue = 6;

                rewardChance          = 1.2;
                corruptionStoneChance = 1.0;
                upgradeTokenChance    = .8;
                break;

            //Sentry
            case 7:
                scoreValue = 7;

                rewardChance          = 1.4;
                corruptionStoneChance = 1.2;
                upgradeTokenChance    = 1.0;
                break;

            case 8:
                scoreValue = 8;

                rewardChance          = 1.4;
                corruptionStoneChance = 1.2;
                upgradeTokenChance    = 1.0;
                break;

            //Unique
            case 9:
                scoreValue = 9;

                rewardChance          = 2;
                corruptionStoneChance = 2;
                upgradeTokenChance    = 2;
                break;

            case 10:
                scoreValue = 40;

                rewardChance          = 2;
                corruptionStoneChance = 2;
                upgradeTokenChance    = 2;
                break;

            case 11:
                scoreValue = 80;

                rewardChance          = 2;
                corruptionStoneChance = 2;
                upgradeTokenChance    = 2;
                break;
            }

            #endregion

            bool playerThresholdReached = false;

            int totalDamage       = 0;
            int totalPlayerDamage = 0;

            //Determine Total Damaged Inflicted and Per Player
            foreach (DamageEntry entry in DamageEntries)
            {
                if (!entry.HasExpired)
                {
                    Mobile damager = entry.Damager;

                    if (damager == null)
                    {
                        continue;
                    }

                    totalDamage += entry.DamageGiven;

                    PlayerMobile playerDamager = damager as PlayerMobile;

                    if (playerDamager != null)
                    {
                        totalPlayerDamage += entry.DamageGiven;
                    }

                    BaseCreature creatureDamager = damager as BaseCreature;

                    if (creatureDamager != null)
                    {
                        if (creatureDamager.ControlMaster is PlayerMobile)
                        {
                            totalPlayerDamage += entry.DamageGiven;
                        }
                    }
                }
            }

            foreach (DamageEntry entry in DamageEntries)
            {
                if (!entry.HasExpired && entry.DamageGiven > 0)
                {
                    PlayerMobile player = null;

                    Mobile damager = entry.Damager;

                    if (damager == null)
                    {
                        continue;
                    }
                    if (damager.Deleted)
                    {
                        continue;
                    }

                    PlayerMobile pm_Damager = damager as PlayerMobile;
                    BaseCreature bc_Damager = damager as BaseCreature;

                    if (pm_Damager != null)
                    {
                        player = pm_Damager;
                    }

                    if (bc_Damager != null)
                    {
                        if (bc_Damager.Controlled && bc_Damager.ControlMaster is PlayerMobile)
                        {
                            if (!bc_Damager.ControlMaster.Deleted)
                            {
                                player = bc_Damager.ControlMaster as PlayerMobile;
                            }
                        }
                    }

                    if (player != null)
                    {
                        if (m_PlayerDamageDealt.ContainsKey(player))
                        {
                            m_PlayerDamageDealt[player] += entry.DamageGiven;
                        }

                        else
                        {
                            m_PlayerDamageDealt.Add(player, entry.DamageGiven);
                        }
                    }
                }
            }

            Queue m_Queue = new Queue();

            foreach (KeyValuePair <PlayerMobile, int> playerEntry in m_PlayerDamageDealt)
            {
                PlayerMobile player = playerEntry.Key;
                int          damage = playerEntry.Value;

                if (player.IsUOACZUndead)
                {
                    double damagePercentOfTotal = (double)damage / totalDamage;

                    if (damage >= 100 || damagePercentOfTotal > .10)
                    {
                        UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadScore, scoreValue, true);

                        if (!player.m_UOACZAccountEntry.UndeadProfile.m_FormsKilledWith.Contains(player.m_UOACZAccountEntry.UndeadProfile.ActiveForm))
                        {
                            player.m_UOACZAccountEntry.UndeadProfile.m_FormsKilledWith.Add(player.m_UOACZAccountEntry.UndeadProfile.ActiveForm);
                        }

                        if (this is UOACZBaseCivilian)
                        {
                            player.m_UOACZAccountEntry.CiviliansKilledAsUndead++;
                        }

                        if (this is UOACZBaseMilitia)
                        {
                            player.m_UOACZAccountEntry.MilitiaKilledAsUndead++;
                        }

                        m_PotentialPlayers.Add(player);
                    }
                }

                else if (player.IsUOACZHuman)
                {
                    m_Queue.Enqueue(player);
                }
            }

            while (m_Queue.Count > 0)
            {
                PlayerMobile player = (PlayerMobile)m_Queue.Dequeue();

                player.SendMessage("You have killed a human.");

                UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.Honor, UOACZSystem.HumanKillCivilianHonorLoss, true);
            }

            double playerDamageRatio = (double)totalPlayerDamage / (double)totalDamage;
            double npcHelpScalar     = playerDamageRatio;

            if (m_PotentialPlayers.Count >= 3)
            {
                rewardChance          *= .75;
                corruptionStoneChance *= .75;
                upgradeTokenChance    *= .75;
            }

            if (m_PotentialPlayers.Count >= 5)
            {
                rewardChance          *= .75;
                corruptionStoneChance *= .75;
                upgradeTokenChance    *= .75;
            }

            rewardChance          *= UOACZPersistance.UndeadBalanceScalar;
            corruptionStoneChance *= UOACZPersistance.UndeadBalanceScalar;
            upgradeTokenChance    *= UOACZPersistance.UndeadBalanceScalar;

            foreach (PlayerMobile player in m_PotentialPlayers)
            {
                bool dropCorruptionStone = false;
                bool dropUpgradeToken    = false;

                if (Utility.RandomDouble() <= (rewardChance * npcHelpScalar))
                {
                    if (player.Backpack != null)
                    {
                        player.Backpack.DropItem(new UOACZBrains());
                        player.SendMessage(UOACZSystem.greenTextHue, "You have received a reward.");
                    }
                }

                if (Utility.RandomDouble() <= (corruptionStoneChance * npcHelpScalar))
                {
                    if (player.Backpack != null)
                    {
                        player.Backpack.DropItem(new UOACZCorruptionStone(player));
                        player.SendMessage(UOACZSystem.greenTextHue, "You have received a corruption stone.");
                    }
                }

                if (Utility.RandomDouble() <= (upgradeTokenChance * npcHelpScalar))
                {
                    if (player.Backpack != null)
                    {
                        player.Backpack.DropItem(new UOACZUndeadUpgradeToken(player));
                        player.SendMessage(UOACZSystem.greenTextHue, "You have received an upgrade token.");
                    }
                }
            }
        }
示例#6
0
        public virtual void Consume(PlayerMobile player)
        {
            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            switch (ConsumptionType)
            {
            case ConsumptionMode.Food:
                player.PlaySound(Utility.RandomList(0x5DA, 0x5A9, 0x5AB, 0x03A, 0x03B, 0x03C));
                player.Animate(34, 5, 1, true, false, 0);

                player.m_UOACZAccountEntry.FoodItemsConsumed++;
                break;

            case ConsumptionMode.Drink:
                Effects.PlaySound(player.Location, player.Map, Utility.RandomList(0x030, 0x031, 0x050));
                player.Animate(34, 5, 1, true, false, 0);

                player.m_UOACZAccountEntry.DrinkItemsConsumed++;
                break;
            }

            Charges--;

            DropContainerToPlayer(player);

            Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate
            {
                if (player == null)
                {
                    return;
                }

                UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

                if (player.Deleted || !player.Alive)
                {
                    return;
                }
                if (player.m_UOACZAccountEntry.ActiveProfile != UOACZAccountEntry.ActiveProfileType.Human)
                {
                    return;
                }

                player.Heal(HitsChange);
                player.Stam += StamChange;
                player.Mana += ManaChange;

                int baseDiseaseAmount = 0;
                double diseaseAmount  = 0;

                if (ConsumptionQualityType == ConsumptionQuality.Raw)
                {
                    player.SendMessage("You eat the raw meat and wish it had been cooked first.");

                    baseDiseaseAmount = UOACZSystem.RawMeatDiseaseAmount;
                    diseaseAmount     = UOACZSystem.RawMeatDiseaseAmount;
                }

                if (ConsumptionQualityType == ConsumptionQuality.Corrupted)
                {
                    player.SendMessage("You eat the corrupted meat and wish it had been purified alchemically first.");

                    baseDiseaseAmount = UOACZSystem.CorruptedMeatDiseaseAmount;
                    diseaseAmount     = UOACZSystem.CorruptedMeatDiseaseAmount;
                }

                if (diseaseAmount > 0)
                {
                    bool foundDisease = false;

                    Queue m_EntriesToRemove = new Queue();

                    foreach (SpecialAbilityEffectEntry entry in player.m_SpecialAbilityEffectEntries)
                    {
                        if (entry.m_SpecialAbilityEffect == SpecialAbilityEffect.Disease && DateTime.UtcNow < entry.m_Expiration)
                        {
                            if (!foundDisease)
                            {
                                diseaseAmount += entry.m_Value;
                                foundDisease   = true;
                            }

                            m_EntriesToRemove.Enqueue(entry);
                        }
                    }

                    while (m_EntriesToRemove.Count > 0)
                    {
                        SpecialAbilityEffectEntry entry = (SpecialAbilityEffectEntry)m_EntriesToRemove.Dequeue();

                        player.m_SpecialAbilityEffectEntries.Remove(entry);
                    }

                    if (!player.Hidden)
                    {
                        Effects.PlaySound(player.Location, player.Map, 0x5CB);
                        Effects.SendLocationParticles(EffectItem.Create(player.Location, player.Map, TimeSpan.FromSeconds(0.25)), 0x376A, 10, 20, 2199, 0, 5029, 0);

                        player.PublicOverheadMessage(MessageType.Regular, 1103, false, "*looks violently ill*");

                        Blood blood = new Blood();
                        blood.Hue   = 2200;
                        blood.MoveToWorld(player.Location, player.Map);

                        int extraBlood = Utility.RandomMinMax(1, 2);

                        for (int i = 0; i < extraBlood; i++)
                        {
                            Blood moreBlood = new Blood();
                            moreBlood.Hue   = 2200;
                            moreBlood.MoveToWorld(new Point3D(player.Location.X + Utility.RandomMinMax(-1, 1), player.Location.Y + Utility.RandomMinMax(-1, 1), player.Location.Z), player.Map);
                        }
                    }

                    AOS.Damage(player, null, baseDiseaseAmount, 0, 100, 0, 0, 0);

                    SpecialAbilities.DiseaseSpecialAbility(1.0, player, player, diseaseAmount, UOACZSystem.FoodDiseaseSeconds, 0, false, "", "");
                }

                UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.Hunger, HungerChange, true);
                UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.Thirst, ThirstChange, true);
            });
        }
示例#7
0
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);

            //Player Swarm Followers
            if (TimesTamed > 0)
            {
                return;
            }

            int scoreValue = 1;

            int intestines = 0;
            int bones      = 0;

            double intestineChance     = 0;
            double normalItemChance    = 0;
            double magicItemChance     = 0;
            double survivalStoneChance = 0;
            double upgradeTokenChance  = 0;

            #region Upgrade Chances

            switch (DifficultyValue)
            {
            case 1:
                scoreValue = 1;
                bones      = 1;
                intestines = 1;

                intestineChance = .20;

                normalItemChance    = .1;
                magicItemChance     = .02;
                survivalStoneChance = .04;
                upgradeTokenChance  = .02;
                break;

            case 2:
                scoreValue = 1;
                bones      = 1;
                intestines = 1;

                intestineChance = .20;

                normalItemChance    = 0.125;
                magicItemChance     = 0.025;
                survivalStoneChance = .05;
                upgradeTokenChance  = .025;
                break;

            case 3:
                scoreValue = 2;
                bones      = 2;
                intestines = 1;

                intestineChance = .30;

                normalItemChance    = .15;
                magicItemChance     = .03;
                survivalStoneChance = .06;
                upgradeTokenChance  = .03;
                break;

            case 4:
                scoreValue = 2;
                bones      = 2;
                intestines = 1;

                intestineChance = .4;

                normalItemChance    = .2;
                magicItemChance     = .04;
                survivalStoneChance = .08;
                upgradeTokenChance  = .04;
                break;

            case 5:
                scoreValue = 3;
                bones      = 3;
                intestines = 1;

                intestineChance = .5;

                normalItemChance    = .25;
                magicItemChance     = .05;
                survivalStoneChance = .1;
                upgradeTokenChance  = .05;
                break;

            case 6:
                scoreValue = 3;
                bones      = 3;
                intestines = 1;

                intestineChance = .6;

                normalItemChance    = .3;
                magicItemChance     = .06;
                survivalStoneChance = .12;
                upgradeTokenChance  = .06;
                break;

            case 7:
                scoreValue = 4;
                bones      = 4;
                intestines = 1;

                intestineChance = .7;

                normalItemChance    = .4;
                magicItemChance     = .08;
                survivalStoneChance = .15;
                upgradeTokenChance  = 0.075;
                break;

            case 8:
                scoreValue = 5;
                bones      = 5;
                intestines = 1;

                intestineChance = .8;

                normalItemChance    = .5;
                magicItemChance     = .1;
                survivalStoneChance = .2;
                upgradeTokenChance  = .1;
                break;

            case 9:
                scoreValue = 6;
                bones      = 6;
                intestines = 1;

                intestineChance = .9;

                normalItemChance    = 1;
                magicItemChance     = .2;
                survivalStoneChance = .25;
                upgradeTokenChance  = .125;
                break;

            case 10:
                scoreValue = 40;
                bones      = 30;
                intestines = 1;

                intestineChance = 1;

                normalItemChance    = 2;
                magicItemChance     = 2;
                survivalStoneChance = 2;
                upgradeTokenChance  = 2;
                break;

            case 11:
                scoreValue = 80;
                bones      = 50;
                intestines = 1;

                intestineChance = 1;

                normalItemChance    = 2;
                magicItemChance     = 2;
                survivalStoneChance = 2;
                upgradeTokenChance  = 2;
                break;
            }

            #endregion

            Dictionary <PlayerMobile, int> m_PlayerDamageDealt = new Dictionary <PlayerMobile, int>();
            List <PlayerMobile>            m_PotentialPlayers  = new List <PlayerMobile>();

            bool playerThresholdReached = false;

            int totalDamage       = 0;
            int totalPlayerDamage = 0;

            //Determine Total Damaged Inflicted and Per Player
            foreach (DamageEntry entry in DamageEntries)
            {
                if (!entry.HasExpired)
                {
                    Mobile damager = entry.Damager;

                    if (damager == null)
                    {
                        continue;
                    }

                    totalDamage += entry.DamageGiven;

                    PlayerMobile playerDamager = damager as PlayerMobile;

                    if (playerDamager != null)
                    {
                        totalPlayerDamage += entry.DamageGiven;
                    }

                    BaseCreature creatureDamager = damager as BaseCreature;

                    if (creatureDamager != null)
                    {
                        if (creatureDamager.ControlMaster is PlayerMobile)
                        {
                            totalPlayerDamage += entry.DamageGiven;
                        }
                    }
                }
            }

            foreach (DamageEntry entry in DamageEntries)
            {
                if (!entry.HasExpired && entry.DamageGiven > 0)
                {
                    PlayerMobile player = null;

                    Mobile damager = entry.Damager;

                    if (damager == null)
                    {
                        continue;
                    }
                    if (damager.Deleted)
                    {
                        continue;
                    }

                    PlayerMobile pm_Damager = damager as PlayerMobile;
                    BaseCreature bc_Damager = damager as BaseCreature;

                    if (pm_Damager != null)
                    {
                        player = pm_Damager;
                    }

                    if (bc_Damager != null)
                    {
                        if (bc_Damager.Controlled && bc_Damager.ControlMaster is PlayerMobile)
                        {
                            if (!bc_Damager.ControlMaster.Deleted)
                            {
                                player = bc_Damager.ControlMaster as PlayerMobile;
                            }
                        }
                    }

                    if (player != null)
                    {
                        if (m_PlayerDamageDealt.ContainsKey(player))
                        {
                            m_PlayerDamageDealt[player] += entry.DamageGiven;
                        }

                        else
                        {
                            m_PlayerDamageDealt.Add(player, entry.DamageGiven);
                        }
                    }
                }
            }

            Queue m_Queue = new Queue();

            foreach (KeyValuePair <PlayerMobile, int> playerEntry in m_PlayerDamageDealt)
            {
                PlayerMobile player = playerEntry.Key;
                int          damage = playerEntry.Value;

                if (player.IsUOACZHuman)
                {
                    double damagePercentOfTotal = (double)damage / totalDamage;

                    if (damage >= 100 || damagePercentOfTotal > .10)
                    {
                        UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);
                        player.m_UOACZAccountEntry.UndeadKilledAsHuman++;

                        UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.HumanScore, scoreValue, true);

                        m_PotentialPlayers.Add(player);
                    }
                }
            }

            if (totalDamage == 0)
            {
                totalDamage = 1;
            }

            double playerDamageRatio = (double)totalPlayerDamage / (double)totalDamage;
            double npcHelpScalar     = playerDamageRatio;

            intestineChance     *= UOACZPersistance.HumanBalanceScalar;
            normalItemChance    *= UOACZPersistance.HumanBalanceScalar;
            magicItemChance     *= UOACZPersistance.HumanBalanceScalar;
            survivalStoneChance *= UOACZPersistance.HumanBalanceScalar;
            upgradeTokenChance  *= UOACZPersistance.HumanBalanceScalar;

            if (playerDamageRatio >= .25)
            {
                if (bones > 0)
                {
                    c.AddItem(new Bone(bones));
                }

                if (Utility.RandomDouble() <= (intestineChance * npcHelpScalar))
                {
                    for (int a = 0; a < intestines; a++)
                    {
                        c.AddItem(new UOACZIntestines());
                    }
                }
            }

            if (Utility.RandomDouble() <= (normalItemChance * npcHelpScalar))
            {
                if (Utility.RandomDouble() <= .4)
                {
                    BaseWeapon weapon = UOACZSystem.GetRandomCrudeBoneWeapon();

                    if (weapon != null)
                    {
                        c.AddItem(weapon);
                    }
                }

                else
                {
                    BaseArmor armor = UOACZSystem.GetRandomCrudeBoneArmor();

                    if (armor != null)
                    {
                        c.AddItem(armor);
                    }
                }
            }

            if (Utility.RandomDouble() <= (magicItemChance * npcHelpScalar))
            {
                switch (Utility.RandomMinMax(1, 2))
                {
                case 1:
                    BaseWeapon weapon = Loot.RandomWeapon();

                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.RandomMinMax(1, 2);
                    weapon.DamageLevel     = (WeaponDamageLevel)Utility.RandomMinMax(1, 2);
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.RandomMinMax(1, 2);

                    weapon.Identified = true;

                    c.AddItem(weapon);
                    break;

                case 2:
                    BaseArmor armor = Loot.RandomArmorOrShield();

                    armor.ProtectionLevel = (ArmorProtectionLevel)Utility.RandomMinMax(1, 2);
                    armor.DurabilityLevel = (ArmorDurabilityLevel)Utility.RandomMinMax(1, 2);

                    armor.Identified = true;

                    c.AddItem(armor);
                    break;
                }
            }

            bool dropSurvivalStone = false;
            bool dropUpgradeToken  = false;

            if (m_PotentialPlayers.Count >= 3)
            {
                survivalStoneChance *= .75;
                upgradeTokenChance  *= .75;
            }

            if (m_PotentialPlayers.Count >= 5)
            {
                survivalStoneChance *= .75;
                upgradeTokenChance  *= .75;
            }

            if (Utility.RandomDouble() <= (survivalStoneChance * npcHelpScalar))
            {
                dropSurvivalStone = true;
            }

            if (Utility.RandomDouble() <= (upgradeTokenChance * npcHelpScalar))
            {
                dropUpgradeToken = true;
            }

            foreach (PlayerMobile player in m_PotentialPlayers)
            {
                if (dropSurvivalStone)
                {
                    c.AddItem(new UOACZSurvivalStone(player));
                }

                if (dropUpgradeToken)
                {
                    c.AddItem(new UOACZHumanUpgradeToken(player));
                }
            }
        }
示例#8
0
        public void PlaceObject(Mobile from, UOACZBaseConstructionDeed constructionDeed)
        {
            if (from == null || constructionDeed == null)
            {
                return;
            }

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            if (m_ConstructionTypeAllowed != ConstructionObjectType.Any)
            {
                if (constructionDeed.ConstructionType != m_ConstructionTypeAllowed)
                {
                    string objectType = "";

                    switch (m_ConstructionTypeAllowed)
                    {
                    case ConstructionObjectType.Fortification: objectType = "fortification"; break;

                    case ConstructionObjectType.Wall: objectType = "wall"; break;
                    }

                    player.SendMessage("Only " + objectType + " type construction objects may be placed at that location.");
                    return;
                }
            }

            Type type = constructionDeed.ConstructableObject;

            UOACZConstructable itemToBuild = (UOACZConstructable)Activator.CreateInstance(type);

            if (itemToBuild == null)
            {
                return;
            }

            Constructable = itemToBuild;
            Constructable.ConstructionTile = this;

            Constructable.MoveToWorld(Location, Map);
            Constructable.Facing = m_ObjectFacing;
            Constructable.UpdateOverrides();
            Constructable.UpdateDamagedState();

            player.PlaySound(0x3E5);
            player.SendMessage("You place the object in the construction slot. Use a repair hammer and restore it to full durability to activate it.");

            if (player.Backpack != null && constructionDeed.CraftedBy == player)
            {
                UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.HumanScore, UOACZSystem.HumanConstructableScorePoints, true);

                if (Utility.RandomDouble() <= UOACZSystem.HumanConstructableSurvivalStoneChance)
                {
                    player.Backpack.AddItem(new UOACZSurvivalStone(player));
                    player.SendMessage("You have earned a survival stone for your construction efforts!");
                }

                if (Utility.RandomDouble() <= UOACZSystem.HumanConstructableUpgradeTokenChance)
                {
                    player.Backpack.AddItem(new UOACZHumanUpgradeToken(player));
                    player.SendMessage("You have earned an upgrade token for your construction efforts!");
                }
            }

            constructionDeed.Delete();
        }
示例#9
0
            protected override void OnTick()
            {
                if (m_RepairHammer == null || m_Player == null)
                {
                    if (m_RepairHammer != null)
                    {
                        m_RepairHammer.m_Owner = null;
                    }

                    if (m_RepairHammer != null)
                    {
                        m_Player.EndAction(typeof(UOACZRepairHammer));
                    }

                    Stop();


                    return;
                }

                if (m_RepairHammer.Deleted || m_Player.Deleted)
                {
                    m_RepairHammer.m_Owner = null;
                    m_Player.EndAction(typeof(UOACZRepairHammer));

                    Stop();
                    return;
                }

                List <UOACZBreakableStatic> m_NearbyBreakableStatics = GetNearbyBreakableStatics(m_Player);

                if (m_NearbyBreakableStatics.Count == 0)
                {
                    m_RepairHammer.m_Owner = null;
                    m_Player.EndAction(typeof(UOACZRepairHammer));

                    Stop();
                    return;
                }

                UOACZBreakableStatic randomBreakableStatic = m_NearbyBreakableStatics[Utility.RandomMinMax(0, m_NearbyBreakableStatics.Count - 1)];

                int repairableCount = 0;

                foreach (UOACZBreakableStatic breakableStatic in m_NearbyBreakableStatics)
                {
                    if (breakableStatic.CanRepair(m_Player, m_RepairHammer, 1.0, false))
                    {
                        repairableCount++;
                    }
                }

                if (repairableCount == 0)
                {
                    m_RepairHammer.m_Owner = null;
                    m_Player.EndAction(typeof(UOACZRepairHammer));

                    m_Player.SendMessage("You stop making repairs.");

                    Stop();
                    return;
                }

                if (m_RepairTicks == 0)
                {
                    m_Player.BeginAction(typeof(BreakableStatic));

                    TimeSpan repairCooldown = TimeSpan.FromSeconds(RepairActionTickDuration.TotalSeconds * (double)RepairActionTicksNeeded);

                    Timer.DelayCall(repairCooldown, delegate
                    {
                        if (m_Player != null)
                        {
                            m_Player.EndAction(typeof(BreakableStatic));
                        }
                    });
                }

                m_RepairTicks++;

                if (randomBreakableStatic.RepairSound != -1)
                {
                    Effects.PlaySound(m_Player.Location, m_Player.Map, randomBreakableStatic.RepairSound);
                }

                m_Player.Animate(12, 5, 1, true, false, 0);
                m_Player.RevealingAction();

                if (m_RepairTicks >= UOACZRepairHammer.RepairActionTicksNeeded)
                {
                    m_RepairTicks = 0;

                    int minRepairAmount = 40;
                    int maxRepairAmount = 60;

                    double baseRepairScalarBonus = 1.0;

                    double carpentryScalar     = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100);
                    double blacksmithingScalar = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100);
                    double tinkeringScalar     = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100);

                    double bestScalar = 1;

                    if (carpentryScalar > bestScalar)
                    {
                        bestScalar = carpentryScalar;
                    }

                    if (blacksmithingScalar > bestScalar)
                    {
                        bestScalar = blacksmithingScalar;
                    }

                    if (tinkeringScalar > bestScalar)
                    {
                        bestScalar = tinkeringScalar;
                    }

                    double repairValue = m_Player.GetSpecialAbilityEntryValue(SpecialAbilityEffect.EmergencyRepairs);

                    bestScalar += repairValue;

                    bool outpostWasRepaired = false;

                    foreach (UOACZBreakableStatic breakableStatic in m_NearbyBreakableStatics)
                    {
                        int repairAmount = Utility.RandomMinMax(minRepairAmount, maxRepairAmount);
                        repairAmount = (int)(Math.Round(((double)repairAmount * bestScalar)));

                        if (breakableStatic.RequiresFullRepair)
                        {
                            BreakableStatic.DamageStateType damageState = breakableStatic.DamageState;

                            breakableStatic.HitPoints += repairAmount;
                            breakableStatic.PublicOverheadMessage(MessageType.Regular, UOACZSystem.greenTextHue, false, "+" + repairAmount);

                            if (breakableStatic.HitPoints < breakableStatic.MaxHitPoints)
                            {
                                breakableStatic.DamageState = damageState;
                            }

                            else
                            {
                                breakableStatic.DamageState = BreakableStatic.DamageStateType.Normal;
                            }
                        }

                        else
                        {
                            breakableStatic.HitPoints += repairAmount;
                            breakableStatic.PublicOverheadMessage(MessageType.Regular, UOACZSystem.greenTextHue, false, "+" + repairAmount);
                        }

                        UOACZPersistance.CheckAndCreateUOACZAccountEntry(m_Player);
                        m_Player.m_UOACZAccountEntry.TotalRepairAmount += repairAmount;

                        m_Player.SendMessage("You repair an object for " + repairAmount.ToString() + " hitpoints.");

                        if (UOACZPersistance.m_OutpostComponents.Contains(breakableStatic))
                        {
                            outpostWasRepaired = true;
                            UOACZEvents.RepairOutpostComponent();
                        }
                    }

                    UOACZPersistance.CheckAndCreateUOACZAccountEntry(m_Player);
                    m_Player.m_UOACZAccountEntry.TimesRepaired++;

                    bool scored = false;

                    double scoreChance = UOACZSystem.HumanRepairScoreChance;

                    if (outpostWasRepaired)
                    {
                        scoreChance += UOACZSystem.HumanOutpostRepairScoreChance;
                    }

                    if (Utility.RandomDouble() <= UOACZSystem.HumanRepairScoreChance)
                    {
                        UOACZSystem.ChangeStat(m_Player, UOACZSystem.UOACZStatType.HumanScore, 1, true);
                        scored = true;
                    }

                    if (m_Player.Backpack != null)
                    {
                        if (Utility.RandomDouble() <= UOACZSystem.HumanRepairSurvivalStoneChance * UOACZPersistance.HumanBalanceScalar)
                        {
                            m_Player.Backpack.DropItem(new UOACZSurvivalStone(m_Player));
                            m_Player.SendMessage(UOACZSystem.greenTextHue, "You have earned a survival stone for your repair efforts!");
                        }

                        if (Utility.RandomDouble() <= UOACZSystem.HumanRepairUpgradeTokenChance * UOACZPersistance.HumanBalanceScalar)
                        {
                            m_Player.Backpack.DropItem(new UOACZHumanUpgradeToken(m_Player));
                            m_Player.SendMessage(UOACZSystem.greenTextHue, "You have earned an upgrade token for your repair efforts!");
                        }
                    }

                    m_RepairHammer.Charges--;

                    if (m_RepairHammer.Charges <= 0)
                    {
                        m_RepairHammer.Delete();
                    }
                }
            }
示例#10
0
        public override void OnGotMeleeAttack(Mobile attacker)
        {
            base.OnGotMeleeAttack(attacker);

            if (Corrupted)
            {
                return;
            }

            if (!UOACZSystem.IsUOACZValidMobile(this))
            {
                return;
            }
            if (!UOACZSystem.IsUOACZValidMobile(attacker))
            {
                return;
            }

            double conversionChance = .25;
            bool   undeadAttacker   = false;

            BaseCreature bc_Attacker = attacker as BaseCreature;
            PlayerMobile pm_Attacker = attacker as PlayerMobile;

            if (pm_Attacker != null)
            {
                if (pm_Attacker.IsUOACZUndead)
                {
                    conversionChance = UOACZSystem.WildlifePlayerCorruptChance;
                    undeadAttacker   = true;
                }
            }

            if (bc_Attacker != null)
            {
                if (!bc_Attacker.Controlled)
                {
                    return;
                }

                if (bc_Attacker is UOACZBaseUndead)
                {
                    conversionChance = UOACZSystem.WildlifeCreatureCorruptChance;
                    undeadAttacker   = true;

                    if (bc_Attacker.ControlMaster is PlayerMobile)
                    {
                        PlayerMobile controlMaster = bc_Attacker.ControlMaster as PlayerMobile;

                        if (controlMaster.IsUOACZUndead && Utility.GetDistance(Location, controlMaster.Location) <= 36)
                        {
                            pm_Attacker = controlMaster;
                        }
                    }
                }
            }

            if (Utility.RandomDouble() <= conversionChance && undeadAttacker)
            {
                if (pm_Attacker != null)
                {
                    pm_Attacker.SendMessage("You corrupt the creature.");

                    UOACZSystem.ChangeStat(pm_Attacker, UOACZSystem.UOACZStatType.UndeadScore, UOACZSystem.UndeadPlayerCorruptWildlifeScore, true);

                    if (Utility.RandomDouble() < UOACZSystem.WildlifeCorruptionStoneChance * UOACZPersistance.UndeadBalanceScalar)
                    {
                        if (pm_Attacker.Backpack != null)
                        {
                            pm_Attacker.Backpack.DropItem(new UOACZCorruptionStone(pm_Attacker));
                            pm_Attacker.SendMessage(UOACZSystem.greenTextHue, "You have received a corruption stone for corrupting wildlife.");
                        }
                    }

                    if (Utility.RandomDouble() < UOACZSystem.WildlifeUpgradeTokenChance * UOACZPersistance.UndeadBalanceScalar)
                    {
                        if (pm_Attacker.Backpack != null)
                        {
                            pm_Attacker.Backpack.DropItem(new UOACZUndeadUpgradeToken(pm_Attacker));
                            pm_Attacker.SendMessage(UOACZSystem.greenTextHue, "You have received an upgrade token for corrupting wildlife.");
                        }
                    }

                    if (Utility.RandomDouble() < UOACZSystem.WildlifeRewardChance * UOACZPersistance.UndeadBalanceScalar)
                    {
                        if (pm_Attacker.Backpack != null)
                        {
                            pm_Attacker.Backpack.DropItem(new UOACZBrains());
                            pm_Attacker.SendMessage(UOACZSystem.greenTextHue, "You have received a reward for corrupting wildlife.");
                        }
                    }
                }

                IPooledEnumerable m_MobilesNearby = Map.GetMobilesInRange(Location, 30);

                foreach (Mobile mobile in m_MobilesNearby)
                {
                    if (!UOACZSystem.IsUOACZValidMobile(mobile))
                    {
                        continue;
                    }

                    if (mobile.Combatant != null)
                    {
                        if (mobile.Combatant == this)
                        {
                            mobile.Combatant = null;
                        }
                    }

                    mobile.RemoveAggressor(this);
                    mobile.RemoveAggressed(this);
                }

                m_MobilesNearby.Free();

                TurnCorrupted(attacker);
            }
        }
示例#11
0
        public override void AfterReceiveDamage(Mobile from, int damage, InteractionType interactionType)
        {
            base.AfterReceiveDamage(from, damage, interactionType);

            PlayerMobile player = from as PlayerMobile;

            if (player != null)
            {
                UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);
                player.m_UOACZAccountEntry.TotalObjectDamage++;
            }

            if (this is UOACZCorruptionSourcestone)
            {
                UOACZEvents.SourceOfCorruptionDamaged(false);

                if (player != null)
                {
                    UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

                    if (player.IsUOACZHuman)
                    {
                        if (Utility.RandomDouble() <= UOACZSystem.HumanDamageSourceStoneScoreChance)
                        {
                            UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.HumanScore, 1, true);
                        }

                        if (player.Backpack != null)
                        {
                            if (Utility.RandomDouble() <= UOACZSystem.HumanDamageSourceStoneSurvivalStoneChance * UOACZPersistance.HumanBalanceScalar)
                            {
                                player.Backpack.DropItem(new UOACZSurvivalStone(player));
                                player.SendMessage(UOACZSystem.greenTextHue, "You have earned a survival stone for damaging the corruption sourcestone!");
                            }

                            if (Utility.RandomDouble() <= UOACZSystem.HumanDamageSourceStoneUpgradeTokenChance * UOACZPersistance.HumanBalanceScalar)
                            {
                                player.Backpack.DropItem(new UOACZHumanUpgradeToken(player));
                                player.SendMessage(UOACZSystem.greenTextHue, "You have earned an upgrade token for damaging the corruption sourcestone!");
                            }
                        }
                    }
                }
            }

            else if (this is UOACZStockpile)
            {
                if (player != null)
                {
                    UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

                    if (player.IsUOACZUndead)
                    {
                        if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileScoreChance)
                        {
                            UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadScore, 1, true);
                        }

                        if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileCorruptionTokenChance * UOACZPersistance.UndeadBalanceScalar)
                        {
                            if (player.Backpack != null)
                            {
                                player.Backpack.DropItem(new UOACZCorruptionStone(player));
                                player.SendMessage(UOACZSystem.greenTextHue, "You have received a corruption stone for damaging a stockpile!");
                            }
                        }

                        if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileUpgradeTokenChance * UOACZPersistance.UndeadBalanceScalar)
                        {
                            if (player.Backpack != null)
                            {
                                player.Backpack.DropItem(new UOACZUndeadUpgradeToken(player));
                                player.SendMessage(UOACZSystem.greenTextHue, "You have received an upgrade token for damaging a stockpile!");
                            }
                        }

                        if (Utility.RandomDouble() <= UOACZSystem.UndeadDamageStockpileRewardChance * UOACZPersistance.UndeadBalanceScalar)
                        {
                            if (player.Backpack != null)
                            {
                                player.Backpack.DropItem(new UOACZBrains());
                                player.SendMessage(UOACZSystem.greenTextHue, "You have received a reward for damaging a stockpile!");
                            }
                        }
                    }
                }
            }

            else
            {
                if (player != null)
                {
                    UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

                    if (player.IsUOACZUndead)
                    {
                        bool outpostObject = false;

                        if (UOACZPersistance.m_OutpostComponents.Contains(this))
                        {
                            outpostObject = true;
                        }

                        double scoreChance      = UOACZSystem.UndeadDamageObjectScoreChance;
                        double corruptionChance = UOACZSystem.UndeadDamageObjectCorruptionTokenChance * UOACZPersistance.UndeadBalanceScalar;
                        double upgradeChance    = UOACZSystem.UndeadDamageObjectUpgradeTokenChance * UOACZPersistance.UndeadBalanceScalar;
                        double rewardChance     = UOACZSystem.UndeadDamageObjectRewardChance * UOACZPersistance.UndeadBalanceScalar;

                        if (outpostObject)
                        {
                            scoreChance      *= UOACZSystem.UndeadDamageOutpostRewardReduction;
                            corruptionChance *= UOACZSystem.UndeadDamageOutpostRewardReduction;
                            upgradeChance    *= UOACZSystem.UndeadDamageOutpostRewardReduction;
                            rewardChance     *= UOACZSystem.UndeadDamageOutpostRewardReduction;

                            if (UOACZPersistance.m_HumanObjective1 == UOACZPersistance.m_HumanObjective1Target)
                            {
                                scoreChance      *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction;
                                corruptionChance *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction;
                                upgradeChance    *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction;
                                rewardChance     *= UOACZSystem.UndeadDamageOutpostAlreadyBuiltRewardReduction;
                            }
                        }

                        if (Utility.RandomDouble() <= scoreChance)
                        {
                            UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadScore, 1, true);
                        }

                        if (player.Backpack != null)
                        {
                            if (Utility.RandomDouble() <= corruptionChance)
                            {
                                player.Backpack.DropItem(new UOACZCorruptionStone(player));
                                player.SendMessage(UOACZSystem.greenTextHue, "You have earned a corruption stone for destruction!");
                            }

                            if (Utility.RandomDouble() <= upgradeChance)
                            {
                                player.Backpack.DropItem(new UOACZUndeadUpgradeToken(player));
                                player.SendMessage(UOACZSystem.greenTextHue, "You have earned an upgrade token for destruction!");
                            }

                            if (Utility.RandomDouble() <= rewardChance)
                            {
                                player.Backpack.DropItem(new UOACZBrains());
                                player.SendMessage(UOACZSystem.greenTextHue, "You have received a reward for destruction.");
                            }
                        }
                    }
                }
            }
        }