public static ShipStatsProfile ApplyCreationModifiers(BaseShipDeed shipDeed, BaseShip ship, ShipStatsProfile shipStatsProfile) { if (shipStatsProfile == null) { return(shipStatsProfile); } #region Get Properties if (shipDeed != null) { shipStatsProfile.HoldSizeCreationModifier = shipDeed.HoldSizeCreationModifier; shipStatsProfile.MaxHitPointsCreationModifier = shipDeed.MaxHitPointsCreationModifier; shipStatsProfile.MaxSailPointsCreationModifier = shipDeed.MaxSailPointsCreationModifier; shipStatsProfile.MaxGunPointsCreationModifier = shipDeed.MaxGunPointsCreationModifier; shipStatsProfile.ForwardSpeedCreationModifier = shipDeed.ForwardSpeedCreationModifier; shipStatsProfile.DriftSpeedCreationModifier = shipDeed.DriftSpeedCreationModifier; shipStatsProfile.SlowdownModePenaltyCreationModifier = shipDeed.SlowdownModePenaltyCreationModifier; shipStatsProfile.CannonAccuracyCreationModifier = shipDeed.CannonAccuracyCreationModifier; shipStatsProfile.CannonDamageCreationModifier = shipDeed.CannonDamageCreationModifier; shipStatsProfile.CannonRangeCreationModifier = shipDeed.CannonRangeCreationModifier; shipStatsProfile.CannonReloadDurationCreationModifier = shipDeed.CannonReloadDurationCreationModifier; shipStatsProfile.MinorAbilityCooldownDurationCreationModifier = shipDeed.MinorAbilityCooldownDurationCreationModifier; shipStatsProfile.MajorAbilityCooldownDurationCreationModifier = shipDeed.MajorAbilityCooldownDurationCreationModifier; shipStatsProfile.EpicAbilityCooldownDurationCreationModifier = shipDeed.EpicAbilityCooldownDurationCreationModifier; shipStatsProfile.RepairCooldownDurationCreationModifier = shipDeed.RepairCooldownDurationCreationModifier; shipStatsProfile.BoardingChanceCreationModifier = shipDeed.BoardingChanceCreationModifier; } if (ship != null) { shipStatsProfile.HoldSizeCreationModifier = ship.HoldSizeCreationModifier; shipStatsProfile.MaxHitPointsCreationModifier = ship.MaxHitPointsCreationModifier; shipStatsProfile.MaxSailPointsCreationModifier = ship.MaxSailPointsCreationModifier; shipStatsProfile.MaxGunPointsCreationModifier = ship.MaxGunPointsCreationModifier; shipStatsProfile.ForwardSpeedCreationModifier = ship.ForwardSpeedCreationModifier; shipStatsProfile.DriftSpeedCreationModifier = ship.DriftSpeedCreationModifier; shipStatsProfile.SlowdownModePenaltyCreationModifier = ship.SlowdownModePenaltyCreationModifier; shipStatsProfile.CannonAccuracyCreationModifier = ship.CannonAccuracyCreationModifier; shipStatsProfile.CannonDamageCreationModifier = ship.CannonDamageCreationModifier; shipStatsProfile.CannonRangeCreationModifier = ship.CannonRangeCreationModifier; shipStatsProfile.CannonReloadDurationCreationModifier = ship.CannonReloadDurationCreationModifier; shipStatsProfile.MinorAbilityCooldownDurationCreationModifier = ship.MinorAbilityCooldownDurationCreationModifier; shipStatsProfile.MajorAbilityCooldownDurationCreationModifier = ship.MajorAbilityCooldownDurationCreationModifier; shipStatsProfile.EpicAbilityCooldownDurationCreationModifier = ship.EpicAbilityCooldownDurationCreationModifier; shipStatsProfile.RepairCooldownDurationCreationModifier = ship.RepairCooldownDurationCreationModifier; shipStatsProfile.BoardingChanceCreationModifier = ship.BoardingChanceCreationModifier; } #endregion return(shipStatsProfile); }
public static ShipStatsProfile ApplyUpgradeModifiers(BaseShipDeed shipDeed, BaseShip ship, ShipStatsProfile shipStatsProfile) { if (shipStatsProfile == null) { return(shipStatsProfile); } List <ShipUpgradeDetail> m_UpgradeDetails = new List <ShipUpgradeDetail>(); ShipUpgrades.ThemeType m_ThemeUpgrade = ShipUpgrades.ThemeType.None; ShipUpgrades.PaintType m_PaintUpgrade = ShipUpgrades.PaintType.None; ShipUpgrades.CannonMetalType m_CannonMetalUpgrade = ShipUpgrades.CannonMetalType.None; ShipUpgrades.OutfittingType m_OutfittingUpgrade = ShipUpgrades.OutfittingType.None; ShipUpgrades.BannerType m_BannerUpgrade = ShipUpgrades.BannerType.None; ShipUpgrades.CharmType m_CharmUpgrade = ShipUpgrades.CharmType.None; ShipUpgrades.MinorAbilityType m_MinorAbilityUpgrade = ShipUpgrades.MinorAbilityType.None; ShipUpgrades.MajorAbilityType m_MajorAbilityUpgrade = ShipUpgrades.MajorAbilityType.None; ShipUpgrades.EpicAbilityType m_EpicAbilityUpgrade = ShipUpgrades.EpicAbilityType.None; #region Get Properties if (shipDeed != null) { m_ThemeUpgrade = shipDeed.m_ThemeUpgrade; m_PaintUpgrade = shipDeed.m_PaintUpgrade; m_CannonMetalUpgrade = shipDeed.m_CannonMetalUpgrade; m_OutfittingUpgrade = shipDeed.m_OutfittingUpgrade; m_BannerUpgrade = shipDeed.m_BannerUpgrade; m_CharmUpgrade = shipDeed.m_CharmUpgrade; m_MinorAbilityUpgrade = shipDeed.m_MinorAbilityUpgrade; m_MajorAbilityUpgrade = shipDeed.m_MajorAbilityUpgrade; m_EpicAbilityUpgrade = shipDeed.m_EpicAbilityUpgrade; } if (ship != null) { m_ThemeUpgrade = ship.m_ThemeUpgrade; m_PaintUpgrade = ship.m_PaintUpgrade; m_CannonMetalUpgrade = ship.m_CannonMetalUpgrade; m_OutfittingUpgrade = ship.m_OutfittingUpgrade; m_BannerUpgrade = ship.m_BannerUpgrade; m_CharmUpgrade = ship.m_CharmUpgrade; m_MinorAbilityUpgrade = ship.m_MinorAbilityUpgrade; m_MajorAbilityUpgrade = ship.m_MajorAbilityUpgrade; m_EpicAbilityUpgrade = ship.m_EpicAbilityUpgrade; } #endregion #region Apply Upgrades m_UpgradeDetails.Add(ShipUpgrades.GetThemeDetail(m_ThemeUpgrade)); m_UpgradeDetails.Add(ShipUpgrades.GetPaintDetail(m_PaintUpgrade)); m_UpgradeDetails.Add(ShipUpgrades.GetCannonMetalDetail(m_CannonMetalUpgrade)); m_UpgradeDetails.Add(ShipUpgrades.GetOutfittingDetail(m_OutfittingUpgrade)); m_UpgradeDetails.Add(ShipUpgrades.GetBannerDetail(m_BannerUpgrade)); m_UpgradeDetails.Add(ShipUpgrades.GetCharmDetail(m_CharmUpgrade)); m_UpgradeDetails.Add(ShipUpgrades.GetMinorAbilityDetail(m_MinorAbilityUpgrade)); m_UpgradeDetails.Add(ShipUpgrades.GetMajorAbilityDetail(m_MajorAbilityUpgrade)); m_UpgradeDetails.Add(ShipUpgrades.GetEpicAbilityDetail(m_EpicAbilityUpgrade)); foreach (ShipUpgradeDetail shipUpgradeDetail in m_UpgradeDetails) { if (shipUpgradeDetail == null) { continue; } shipStatsProfile.HoldSizeUpgradeModifier += shipUpgradeDetail.HoldCapacity; shipStatsProfile.MaxHitPointsUpgradeModifier += shipUpgradeDetail.MaxHitPoints; shipStatsProfile.MaxSailPointsUpgradeModifier += shipUpgradeDetail.MaxSailPoints; shipStatsProfile.MaxGunPointsUpgradeModifier += shipUpgradeDetail.MaxGunPoints; shipStatsProfile.ForwardSpeedUpgradeModifier += shipUpgradeDetail.ForwardSpeed; shipStatsProfile.DriftSpeedUpgradeModifier += shipUpgradeDetail.DriftSpeed; shipStatsProfile.SlowdownModePenaltyUpgradeModifier += shipUpgradeDetail.SlowdownModePenalty; shipStatsProfile.CannonAccuracyUpgradeModifier += shipUpgradeDetail.CannonAccuracy; shipStatsProfile.CannonDamageUpgradeModifier += shipUpgradeDetail.CannonDamage; shipStatsProfile.CannonRangeUpgradeModifier += shipUpgradeDetail.CannonRange; shipStatsProfile.CannonReloadDurationUpgradeModifier += shipUpgradeDetail.CannonReloadTime; shipStatsProfile.MinorAbilityCooldownDurationUpgradeModifier += shipUpgradeDetail.MinorAbilityCooldown; shipStatsProfile.MajorAbilityCooldownDurationUpgradeModifier += shipUpgradeDetail.MajorAbilityCooldown; shipStatsProfile.EpicAbilityCooldownDurationUpgradeModifier += shipUpgradeDetail.EpicAbilityCooldown; shipStatsProfile.RepairCooldownDurationUpgradeModifier += shipUpgradeDetail.RepairCooldown; shipStatsProfile.BoardingChanceUpgradeModifier += shipUpgradeDetail.BoardingChance; shipStatsProfile.CannonEnemyCrewDamageUpgradeModifier += shipUpgradeDetail.CannonEnemyCrewDamage; shipStatsProfile.CannonHitPointsDamageUpgradeModifier += shipUpgradeDetail.CannonHitPointsDamage; shipStatsProfile.CannonSailPointsDamageUpgradeModifier += shipUpgradeDetail.CannonSailPointsDamage; shipStatsProfile.CannonGunPointsDamageUpgradeModifier += shipUpgradeDetail.CannonGunPointsDamage; shipStatsProfile.CrewDamageMeleeDamageDealtUpgradeModifier += shipUpgradeDetail.CrewDamageMeleeDamageDealt; shipStatsProfile.CrewDamageSpellDamageDealtUpgradeModifier += shipUpgradeDetail.CrewDamageSpellDamageDealt; shipStatsProfile.CrewDamageMeleeDamageReceivedUpgradeModifier += shipUpgradeDetail.CrewDamageMeleeDamageReceived; shipStatsProfile.CrewDamageSpellDamageReceivedUpgradeModifier += shipUpgradeDetail.CrewDamageSpellDamageReceived; shipStatsProfile.CrewDamageCannonDamageReceivedUpgradeModifier += shipUpgradeDetail.CrewDamageCannonDamageReceived; shipStatsProfile.RepairHitPointsBonusUpgradeModifier += shipUpgradeDetail.RepairHitPointsBonus; shipStatsProfile.RepairSailPointsBonusUpgradeModifier += shipUpgradeDetail.RepairSailPointsBonus; shipStatsProfile.RepairGunPointsBonusUpgradeModifier += shipUpgradeDetail.RepairGunPointsBonus; shipStatsProfile.RepairMaterialsReductionUpgradeModifier += shipUpgradeDetail.RepairMaterialsReduction; shipStatsProfile.MinorAbilityEffectivenessUpgradeModifier += shipUpgradeDetail.MinorAbilityEffectiveness; shipStatsProfile.MajorAbilityEffectivenessUpgradeModifier += shipUpgradeDetail.MajorAbilityEffectiveness; shipStatsProfile.EpicAbilityEffectivenessUpgradeModifier += shipUpgradeDetail.EpicAbilityEffectiveness; shipStatsProfile.CrewHealingReceivedUpgradeModifier += shipUpgradeDetail.CrewHealingReceived; shipStatsProfile.DoubloonsEarnedFromEnemyCrewUpgradeModifier += shipUpgradeDetail.DoubloonsEarnedFromEnemyCrew; shipStatsProfile.DoubloonsEarnedFromEnemyShipsUpgradeModifier += shipUpgradeDetail.DoubloonsEarnedFromEnemyShips; shipStatsProfile.FishingSuccessUpgradeModifier += shipUpgradeDetail.FishingSuccess; shipStatsProfile.SpyglassAccuracyUpgradeModifier += shipUpgradeDetail.SpyglassAccuracy; } #endregion return(shipStatsProfile); }
public static ShipStatsProfile GetShipStatsProfile(BaseShipDeed shipDeed, BaseShip ship, bool applyCreationModifiers, bool applyUpgradeModifiers) { Type type = null; if (shipDeed != null) { type = shipDeed.ShipType; } if (ship != null) { type = ship.GetType(); } ShipStatsProfile shipStatsProfile = new ShipStatsProfile(); if (type == null) { return(shipStatsProfile); } shipStatsProfile.shipType = type; #region Small Ship if (type == typeof(SmallShip) || type == typeof(SmallDragonShip)) { if (type == typeof(SmallShip)) { shipStatsProfile.ShipTypeName = "small ship"; } if (type == typeof(SmallDragonShip)) { shipStatsProfile.ShipTypeName = "small dragon ship"; } if (ship != null) { if (ship.MobileControlType == MobileControlType.Player) { } else { } } } #endregion #region Medium Ship if (type == typeof(MediumShip) || type == typeof(MediumDragonShip)) { if (type == typeof(MediumShip)) { shipStatsProfile.ShipTypeName = "medium ship"; } if (type == typeof(MediumDragonShip)) { shipStatsProfile.ShipTypeName = "medium dragon ship"; } shipStatsProfile.RegistrationDoubloonCost = 500; shipStatsProfile.UpgradeDoubloonMultiplier = 1.5; shipStatsProfile.HoldSize = 75; shipStatsProfile.ForwardSpeed = 0.25; shipStatsProfile.DriftSpeed = 0.5; shipStatsProfile.CannonsPerSide = 4; shipStatsProfile.CannonReloadDuration = 8; if (ship != null) { if (ship.MobileControlType == MobileControlType.Player) { shipStatsProfile.MaxHitPoints = 1250; shipStatsProfile.MaxSailPoints = 625; shipStatsProfile.MaxGunPoints = 625; } else { shipStatsProfile.MaxHitPoints = 1250; shipStatsProfile.MaxSailPoints = 625; shipStatsProfile.MaxGunPoints = 625; } } } #endregion #region Large Ship if (type == typeof(LargeShip) || type == typeof(LargeDragonShip)) { if (type == typeof(LargeShip)) { shipStatsProfile.ShipTypeName = "large ship"; } if (type == typeof(LargeDragonShip)) { shipStatsProfile.ShipTypeName = "large dragon ship"; } shipStatsProfile.RegistrationDoubloonCost = 1500; shipStatsProfile.UpgradeDoubloonMultiplier = 2.0; shipStatsProfile.HoldSize = 100; shipStatsProfile.ForwardSpeed = 0.3; shipStatsProfile.DriftSpeed = 0.6; shipStatsProfile.CannonsPerSide = 5; shipStatsProfile.CannonReloadDuration = 10; if (ship.MobileControlType == MobileControlType.Player) { shipStatsProfile.MaxHitPoints = 1500; shipStatsProfile.MaxSailPoints = 750; shipStatsProfile.MaxGunPoints = 750; } else { shipStatsProfile.MaxHitPoints = 1500; shipStatsProfile.MaxSailPoints = 750; shipStatsProfile.MaxGunPoints = 750; } } #endregion #region Carrack if (type == typeof(Carrack)) { shipStatsProfile.ShipTypeName = "carrack"; shipStatsProfile.RegistrationDoubloonCost = 5000; shipStatsProfile.UpgradeDoubloonMultiplier = 3.0; shipStatsProfile.HoldSize = 125; shipStatsProfile.ForwardSpeed = 0.35; shipStatsProfile.DriftSpeed = 0.7; shipStatsProfile.CannonsPerSide = 6; shipStatsProfile.CannonReloadDuration = 12; if (ship.MobileControlType == MobileControlType.Player) { shipStatsProfile.MaxHitPoints = 2000; shipStatsProfile.MaxSailPoints = 1000; shipStatsProfile.MaxGunPoints = 1000; } else { shipStatsProfile.MaxHitPoints = 2000; shipStatsProfile.MaxSailPoints = 1000; shipStatsProfile.MaxGunPoints = 1000; } } #endregion #region Galleon if (type == typeof(Galleon)) { shipStatsProfile.ShipTypeName = "galleon"; shipStatsProfile.RegistrationDoubloonCost = 20000; shipStatsProfile.UpgradeDoubloonMultiplier = 4.0; shipStatsProfile.HoldSize = 150; shipStatsProfile.ForwardSpeed = 0.4; shipStatsProfile.DriftSpeed = 0.8; shipStatsProfile.CannonsPerSide = 7; shipStatsProfile.CannonReloadDuration = 14; if (ship.MobileControlType == MobileControlType.Player) { shipStatsProfile.MaxHitPoints = 3000; shipStatsProfile.MaxSailPoints = 1500; shipStatsProfile.MaxGunPoints = 1500; } else { shipStatsProfile.MaxHitPoints = 3000; shipStatsProfile.MaxSailPoints = 1500; shipStatsProfile.MaxGunPoints = 1500; } } #endregion #region Ship of the Line if (type == typeof(ShipOfTheLineShip)) { shipStatsProfile.ShipTypeName = "ship of the line"; shipStatsProfile.RegistrationDoubloonCost = 50000; shipStatsProfile.UpgradeDoubloonMultiplier = 5.0; shipStatsProfile.HoldSize = 200; shipStatsProfile.ForwardSpeed = 0.45; shipStatsProfile.DriftSpeed = 0.9; shipStatsProfile.CannonsPerSide = 8; shipStatsProfile.CannonReloadDuration = 16; if (ship.MobileControlType == MobileControlType.Player) { shipStatsProfile.MaxHitPoints = 4000; shipStatsProfile.MaxSailPoints = 2000; shipStatsProfile.MaxGunPoints = 2000; } else { shipStatsProfile.MaxHitPoints = 4000; shipStatsProfile.MaxSailPoints = 2000; shipStatsProfile.MaxGunPoints = 2000; } } #endregion if (applyCreationModifiers) { shipStatsProfile = ApplyCreationModifiers(shipDeed, ship, shipStatsProfile); } if (applyUpgradeModifiers) { shipStatsProfile = ApplyUpgradeModifiers(shipDeed, ship, shipStatsProfile); } shipStatsProfile.CalculateAdjustedValues(); return(shipStatsProfile); }
public static void GenerateCreationModifiers(BaseShipDeed shipDeed, BaseShip ship, Mobile from, Quality quality) { double lowRange = 0.0; double highRange = 0.2; double statMutationChance = .33; if (from != null) { if (from.Skills.Carpentry.Value > 100.0) { lowRange += .1 * ((from.Skills.Carpentry.Value - 100) / 20); } } else { highRange = 0.1; statMutationChance = .66; } #region Determine and Set Creation Modifiers if (shipDeed != null) { if (Utility.RandomDouble() <= statMutationChance) { shipDeed.HoldSizeCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.MaxHitPointsCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.MaxSailPointsCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.MaxGunPointsCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.ForwardSpeedCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.DriftSpeedCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.SlowdownModePenaltyCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.CannonAccuracyCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.CannonDamageCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.CannonRangeCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.CannonReloadDurationCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.MinorAbilityCooldownDurationCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.MajorAbilityCooldownDurationCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.EpicAbilityCooldownDurationCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.RepairCooldownDurationCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { shipDeed.BoardingChanceCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } } if (ship != null) { if (Utility.RandomDouble() <= statMutationChance) { ship.HoldSizeCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.MaxHitPointsCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.MaxSailPointsCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.MaxGunPointsCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.ForwardSpeedCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.DriftSpeedCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.SlowdownModePenaltyCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.CannonAccuracyCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.CannonDamageCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.CannonRangeCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.CannonReloadDurationCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.MinorAbilityCooldownDurationCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.MajorAbilityCooldownDurationCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.EpicAbilityCooldownDurationCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.RepairCooldownDurationCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } if (Utility.RandomDouble() <= statMutationChance) { ship.BoardingChanceCreationModifier = -.1 + (lowRange + (Utility.RandomDouble() * (highRange - lowRange))); } } #endregion }
protected override void OnTarget(Mobile from, object target) { if (m_Player == null) { return; } if (m_Player.Backpack == null) { return; } if (m_ShipUpgradeGumpObject == null) { return; } if (m_ShipUpgradeGumpObject.m_ShipUpgradeDeed == null) { m_Player.SendMessage("That upgrade deed is no longer accessible."); return; } if (m_ShipUpgradeGumpObject.m_ShipUpgradeDeed.Deleted) { m_Player.SendMessage("That upgrade deed is no longer accessible."); return; } if (!m_ShipUpgradeGumpObject.m_ShipUpgradeDeed.IsChildOf(m_Player.Backpack)) { m_Player.SendMessage("The upgrade deed you wish to use must be in your backpack."); return; } BaseShipDeed shipDeed = target as BaseShipDeed; if (shipDeed == null) { m_Player.SendMessage("You must target a ship token."); return; } if (shipDeed.Deleted) { m_Player.SendMessage("You must target a ship token."); return; } if (!shipDeed.IsChildOf(m_Player.Backpack)) { m_Player.SendMessage("You must target a ship token in your backpack."); return; } m_ShipUpgradeGumpObject.m_ShipType = shipDeed.ShipType; m_ShipUpgradeGumpObject.m_ShipDeed = shipDeed; m_ShipUpgradeGumpObject.m_UpgradeDisplayMode = ShipUpgradeGump.UpgradeDisplayMode.DeedAttemptInstall; m_Player.CloseGump(typeof(ShipUpgradeGump)); m_Player.SendGump(new ShipUpgradeGump(m_Player, m_ShipUpgradeGumpObject)); }
public override void OnResponse(NetState sender, RelayInfo info) { if (m_Player == null) { return; } if (m_Player.Deleted) { return; } if (m_Player.Backpack == null) { return; } if (m_ShipUpgradeGumpObject == null) { return; } bool closeGump = true; BaseShip ship = m_ShipUpgradeGumpObject.m_Ship; BaseShipDeed shipDeed = m_ShipUpgradeGumpObject.m_ShipDeed; ShipUpgradeDeed shipUpgradeDeed = m_ShipUpgradeGumpObject.m_ShipUpgradeDeed; ShipStatsProfile shipStatsProfile = ShipUniqueness.GetShipStatsProfile(shipDeed, ship, true, true); ShipUpgradeDetail upgradeDetail = null; bool replaceExistingUpgrade = false; #region Upgrade Type switch (m_ShipUpgradeGumpObject.m_UpgradeType) { case ShipUpgrades.UpgradeType.Theme: if (ship != null) { if (ship.m_ThemeUpgrade != ShipUpgrades.ThemeType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_ThemeUpgrade != ShipUpgrades.ThemeType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetThemeDetail(m_ShipUpgradeGumpObject.m_Theme); break; case ShipUpgrades.UpgradeType.Paint: if (ship != null) { if (ship.m_PaintUpgrade != ShipUpgrades.PaintType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_PaintUpgrade != ShipUpgrades.PaintType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetPaintDetail(m_ShipUpgradeGumpObject.m_Paint); break; case ShipUpgrades.UpgradeType.CannonMetal: if (ship != null) { if (ship.m_CannonMetalUpgrade != ShipUpgrades.CannonMetalType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_CannonMetalUpgrade != ShipUpgrades.CannonMetalType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetCannonMetalDetail(m_ShipUpgradeGumpObject.m_CannonMetal); break; case ShipUpgrades.UpgradeType.Outfitting: if (ship != null) { if (ship.m_OutfittingUpgrade != ShipUpgrades.OutfittingType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_OutfittingUpgrade != ShipUpgrades.OutfittingType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetOutfittingDetail(m_ShipUpgradeGumpObject.m_Outfitting); break; case ShipUpgrades.UpgradeType.Banner: if (ship != null) { if (ship.m_BannerUpgrade != ShipUpgrades.BannerType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_BannerUpgrade != ShipUpgrades.BannerType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetBannerDetail(m_ShipUpgradeGumpObject.m_Banner); break; case ShipUpgrades.UpgradeType.Charm: if (ship != null) { if (ship.m_CharmUpgrade != ShipUpgrades.CharmType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_CharmUpgrade != ShipUpgrades.CharmType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetCharmDetail(m_ShipUpgradeGumpObject.m_Charm); break; case ShipUpgrades.UpgradeType.MinorAbility: if (ship != null) { if (ship.m_MinorAbilityUpgrade != ShipUpgrades.MinorAbilityType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_MinorAbilityUpgrade != ShipUpgrades.MinorAbilityType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetMinorAbilityDetail(m_ShipUpgradeGumpObject.m_MinorAbility); break; case ShipUpgrades.UpgradeType.MajorAbility: if (ship != null) { if (ship.m_MajorAbilityUpgrade != ShipUpgrades.MajorAbilityType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_MajorAbilityUpgrade != ShipUpgrades.MajorAbilityType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetMajorAbilityDetail(m_ShipUpgradeGumpObject.m_MajorAbility); break; case ShipUpgrades.UpgradeType.EpicAbility: if (ship != null) { if (ship.m_EpicAbilityUpgrade != ShipUpgrades.EpicAbilityType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_EpicAbilityUpgrade != ShipUpgrades.EpicAbilityType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetEpicAbilityDetail(m_ShipUpgradeGumpObject.m_EpicAbility); break; } #endregion if (upgradeDetail == null) { return; } switch (info.ButtonID) { //Guide case 1: closeGump = false; break; //Install case 2: switch (m_ShipUpgradeGumpObject.m_UpgradeDisplayMode) { case UpgradeDisplayMode.DeedUse: if (shipUpgradeDeed == null) { m_Player.SendMessage("That deed is no longer accessible."); } else if (shipUpgradeDeed.Deleted) { m_Player.SendMessage("That deed is no longer accessible."); } else if (!shipUpgradeDeed.IsChildOf(m_Player.Backpack)) { m_Player.SendMessage("That deed is no longer accessible."); } else { m_Player.SendMessage("Which ship do you wish to install this upgrade into?"); m_Player.Target = new ShipUpgradeTarget(m_Player, m_ShipUpgradeGumpObject); return; } break; case UpgradeDisplayMode.DeedAttemptInstall: if (shipUpgradeDeed == null) { m_Player.SendMessage("That upgrade deed is no longer accessible."); } else if (shipUpgradeDeed.Deleted) { m_Player.SendMessage("That upgrade deed is no longer accessible."); } else if (!shipUpgradeDeed.IsChildOf(m_Player.Backpack)) { m_Player.SendMessage("That upgrade deed is no longer accessible."); } else if (shipDeed == null) { m_Player.SendMessage("That ship token is no longer accessible."); } else if (shipDeed.Deleted) { m_Player.SendMessage("That ship token is no longer accessible."); } else if (!shipDeed.IsChildOf(m_Player.Backpack)) { m_Player.SendMessage("That ship token is no longer accessible."); } else { int doubloonBaseCost = ShipUniqueness.GetShipUpgradeBaseDoubloonCost(upgradeDetail.m_UpgradeType); double doubloonMultiplier = shipStatsProfile.UpgradeDoubloonMultiplier; int doubloonAdjustedCost = (int)(Math.Round((double)doubloonBaseCost * (double)doubloonMultiplier)); if (replaceExistingUpgrade) { doubloonAdjustedCost = 0; } int doubloonBalance = Banker.GetUniqueCurrencyBalance(m_Player, typeof(Doubloon)); if (doubloonBalance >= doubloonAdjustedCost) { if (doubloonAdjustedCost > 0) { Banker.WithdrawUniqueCurrency(m_Player, typeof(Doubloon), doubloonAdjustedCost, true); } switch (upgradeDetail.m_UpgradeType) { case ShipUpgrades.UpgradeType.Theme: shipDeed.m_ThemeUpgrade = shipUpgradeDeed.m_ThemeUpgrade; break; case ShipUpgrades.UpgradeType.Paint: shipDeed.m_PaintUpgrade = shipUpgradeDeed.m_PaintUpgrade; break; case ShipUpgrades.UpgradeType.CannonMetal: shipDeed.m_CannonMetalUpgrade = shipUpgradeDeed.m_CannonMetalUpgrade; break; case ShipUpgrades.UpgradeType.Outfitting: shipDeed.m_OutfittingUpgrade = shipUpgradeDeed.m_OutfittingUpgrade; break; case ShipUpgrades.UpgradeType.Banner: shipDeed.m_BannerUpgrade = shipUpgradeDeed.m_BannerUpgrade; break; case ShipUpgrades.UpgradeType.Charm: shipDeed.m_CharmUpgrade = shipUpgradeDeed.m_CharmUpgrade; break; case ShipUpgrades.UpgradeType.MinorAbility: shipDeed.m_MinorAbilityUpgrade = shipUpgradeDeed.m_MinorAbilityUpgrade; break; case ShipUpgrades.UpgradeType.MajorAbility: shipDeed.m_MajorAbilityUpgrade = shipUpgradeDeed.m_MajorAbilityUpgrade; break; case ShipUpgrades.UpgradeType.EpicAbility: shipDeed.m_EpicAbilityUpgrade = shipUpgradeDeed.m_EpicAbilityUpgrade; break; } if (m_Player.HasGump(typeof(ShipGump))) { m_Player.CloseGump(typeof(ShipGump)); } ShipGumpObject shipGumpObject = new ShipGumpObject(m_Player, null, shipDeed); shipGumpObject.m_ShipPage = ShipGump.ShipPageType.Upgrades; m_Player.SendGump(new ShipGump(m_Player, shipGumpObject)); if (replaceExistingUpgrade) { m_Player.SendMessage("You place an upgrade onto your ship, overriding the existing one."); } else { m_Player.SendMessage("You place an upgrade onto your ship."); } m_Player.SendSound(0x23D); m_ShipUpgradeGumpObject.m_ShipUpgradeDeed.Delete(); return; } else { m_Player.SendMessage("You do not have the neccessary " + doubloonAdjustedCost.ToString() + " doubloons in your bank box to install this upgrade."); } } break; case UpgradeDisplayMode.InstalledOnShip: break; } closeGump = false; break; } if (!closeGump) { m_Player.CloseGump(typeof(ShipUpgradeGump)); m_Player.SendGump(new ShipUpgradeGump(m_Player, m_ShipUpgradeGumpObject)); } else { m_Player.SendSound(CloseGumpSound); } }
public ShipUpgradeGump(PlayerMobile player, ShipUpgradeGumpObject shipUpgradeGumpObject) : base(325, 150) { m_Player = player; m_ShipUpgradeGumpObject = shipUpgradeGumpObject; if (m_Player == null) { return; } if (m_Player.Deleted) { return; } if (m_ShipUpgradeGumpObject == null) { return; } BaseShip ship = m_ShipUpgradeGumpObject.m_Ship; BaseShipDeed shipDeed = m_ShipUpgradeGumpObject.m_ShipDeed; ShipStatsProfile shipStatsProfile = ShipUniqueness.GetShipStatsProfile(shipDeed, ship, true, true); int startX = 0; int startY = 0; #region Background AddImage(275, 9, 103); AddImage(275, 106, 103); AddImage(275, 149, 103); AddImage(145, 9, 103); AddImage(145, 106, 103); AddImage(146, 149, 103); AddImage(10, 148, 103); AddImage(10, 9, 103); AddImage(10, 106, 103); AddImage(20, 108, 3604, 2052); AddImage(145, 109, 3604, 2052); AddImage(20, 19, 3604, 2052); AddImage(140, 19, 3604, 2052); AddImage(236, 18, 3604, 2052); AddImage(280, 18, 3604, 2052); AddImage(236, 109, 3604, 2052); AddImage(280, 109, 3604, 2052); AddImage(33, 68, 2328); AddItem(82, 173, 2539); #endregion ShipUpgradeDetail upgradeDetail = null; bool replaceExistingUpgrade = false; #region Upgrade Type switch (m_ShipUpgradeGumpObject.m_UpgradeType) { case ShipUpgrades.UpgradeType.Theme: if (ship != null) { if (ship.m_ThemeUpgrade != ShipUpgrades.ThemeType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_ThemeUpgrade != ShipUpgrades.ThemeType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetThemeDetail(m_ShipUpgradeGumpObject.m_Theme); break; case ShipUpgrades.UpgradeType.Paint: if (ship != null) { if (ship.m_PaintUpgrade != ShipUpgrades.PaintType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_PaintUpgrade != ShipUpgrades.PaintType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetPaintDetail(m_ShipUpgradeGumpObject.m_Paint); break; case ShipUpgrades.UpgradeType.CannonMetal: if (ship != null) { if (ship.m_CannonMetalUpgrade != ShipUpgrades.CannonMetalType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_CannonMetalUpgrade != ShipUpgrades.CannonMetalType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetCannonMetalDetail(m_ShipUpgradeGumpObject.m_CannonMetal); break; case ShipUpgrades.UpgradeType.Outfitting: if (ship != null) { if (ship.m_OutfittingUpgrade != ShipUpgrades.OutfittingType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_OutfittingUpgrade != ShipUpgrades.OutfittingType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetOutfittingDetail(m_ShipUpgradeGumpObject.m_Outfitting); break; case ShipUpgrades.UpgradeType.Banner: if (ship != null) { if (ship.m_BannerUpgrade != ShipUpgrades.BannerType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_BannerUpgrade != ShipUpgrades.BannerType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetBannerDetail(m_ShipUpgradeGumpObject.m_Banner); break; case ShipUpgrades.UpgradeType.Charm: if (ship != null) { if (ship.m_CharmUpgrade != ShipUpgrades.CharmType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_CharmUpgrade != ShipUpgrades.CharmType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetCharmDetail(m_ShipUpgradeGumpObject.m_Charm); break; case ShipUpgrades.UpgradeType.MinorAbility: if (ship != null) { if (ship.m_MinorAbilityUpgrade != ShipUpgrades.MinorAbilityType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_MinorAbilityUpgrade != ShipUpgrades.MinorAbilityType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetMinorAbilityDetail(m_ShipUpgradeGumpObject.m_MinorAbility); break; case ShipUpgrades.UpgradeType.MajorAbility: if (ship != null) { if (ship.m_MajorAbilityUpgrade != ShipUpgrades.MajorAbilityType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_MajorAbilityUpgrade != ShipUpgrades.MajorAbilityType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetMajorAbilityDetail(m_ShipUpgradeGumpObject.m_MajorAbility); break; case ShipUpgrades.UpgradeType.EpicAbility: if (ship != null) { if (ship.m_EpicAbilityUpgrade != ShipUpgrades.EpicAbilityType.None) { replaceExistingUpgrade = true; } } if (shipDeed != null) { if (shipDeed.m_EpicAbilityUpgrade != ShipUpgrades.EpicAbilityType.None) { replaceExistingUpgrade = true; } } upgradeDetail = ShipUpgrades.GetEpicAbilityDetail(m_ShipUpgradeGumpObject.m_EpicAbility); break; } #endregion if (upgradeDetail == null) { return; } int doubloonBaseCost = ShipUniqueness.GetShipUpgradeBaseDoubloonCost(upgradeDetail.m_UpgradeType); AddLabel(143, 20, 149, "Ship Outfitting Upgrade"); AddLabel(Utility.CenteredTextOffset(210, upgradeDetail.m_UpgradeName), 40, WhiteTextHue, upgradeDetail.m_UpgradeName); AddLabel(26, 170, 149, "Base Cost:"); AddLabel(114, 170, WhiteTextHue, doubloonBaseCost.ToString()); double doubloonMultiplier = shipStatsProfile.UpgradeDoubloonMultiplier; if (m_ShipUpgradeGumpObject.m_UpgradeDisplayMode == UpgradeDisplayMode.DeedAttemptInstall || m_ShipUpgradeGumpObject.m_UpgradeDisplayMode == UpgradeDisplayMode.InstalledOnShip) { if (replaceExistingUpgrade && m_ShipUpgradeGumpObject.m_UpgradeDisplayMode == UpgradeDisplayMode.DeedAttemptInstall) { AddLabel(26, 190, 149, "Will Replace Existing Upgrade"); AddLabel(213, 190, 2550, "(at no cost)"); } else { AddLabel(26, 190, 149, "Ship Type Multiplier:"); AddLabel(151, 190, WhiteTextHue, Utility.CreateDecimalString(doubloonMultiplier, 1) + "x"); } int doubloonAdjustedCost = (int)(Math.Round((double)doubloonBaseCost * (double)doubloonMultiplier)); if (replaceExistingUpgrade && m_ShipUpgradeGumpObject.m_UpgradeDisplayMode == UpgradeDisplayMode.DeedAttemptInstall) { doubloonAdjustedCost = 0; } AddLabel(26, 210, 149, "Adjusted Cost:"); AddItem(112, 213, 2539); AddLabel(143, 210, 63, doubloonAdjustedCost.ToString()); } startY = 65; int rowSpacing = 20; for (int a = 0; a < upgradeDetail.m_SpecialEffects.Count; a++) { KeyValuePair <string, ShipUpgradeDetail.UpgradeEffectType> descriptionLine = upgradeDetail.m_SpecialEffects[a]; AddLabel(125, startY, upgradeDetail.GetHue(descriptionLine.Value), descriptionLine.Key); startY += rowSpacing; } int offsetX = -32; int offsetY = -22; AddGumpCollection(GumpCollections.GetGumpCollection(upgradeDetail.GumpCollectionId, -1), offsetX + 33, offsetY + 68); //Guide AddButton(6, 7, 2094, 2095, 0, GumpButtonType.Reply, 0); AddLabel(1, -2, 149, "Guide"); switch (m_ShipUpgradeGumpObject.m_UpgradeDisplayMode) { case UpgradeDisplayMode.DeedUse: AddLabel(250, 209, 63, "Select Target Ship"); AddButton(372, 206, 2151, 2151, 2, GumpButtonType.Reply, 0); break; case UpgradeDisplayMode.DeedAttemptInstall: AddLabel(211, 209, 63, "Confirm Ship Installation"); AddButton(372, 206, 2151, 2151, 2, GumpButtonType.Reply, 0); break; case UpgradeDisplayMode.InstalledOnShip: break; } }