public ShipModule SourceObject() { if (this.CraftMaterials == null) { this.CraftMaterials = new Dictionary <string, int>(); } ShipModule result = new ShipModule( (ShipModelSlotType)this.SlotType, this.ModuleId, this.Level, this.Name, (Workshop)this.Workshop, this.TemplateId, this.CraftMaterials, Difficulty.none ); result.SetPrefab(this.Prefab); result.SetHP(this.HP); result.SetHold(this.Hold); result.SetCommonResist(this.Resist); result.SetAcidResist(this.acidResist); result.SetLaserResist(this.laserResist); result.SetRocketResist(this.rocketResist); result.SetSpeed(this.Speed); result.SetDamageBonus(this.DamageBonus); result.SetColor((ObjectColor)this.Color); result.SetSkill(this.Skill); result.SetSet(this.SetID); result.SetCritChance(this.CritChance); result.SetCritDamage(this.CritDamage); result.SetEnergyBonus(this.energyBonus); result.SetSpeedBonus(this.speedBonus); result.SetHoldBonus(this.holdBonus); return(result); }
public ShipModule DropModule() { ModuleInfo moduleData; if (dropParams.useTemplateID) { moduleData = dropParams.moduleInfo; } else { moduleData = dropParams.resource.ModuleTemplates.RandomModule(dropParams.workshop, dropParams.slotType); } if (moduleData == null) { throw new Exception("not found module data"); } ModuleSettingData moduleSetting; if (!dropParams.resource.ModuleSettings.TeyGetWorkshopData(dropParams.workshop, out moduleSetting)) { throw new Exception("not found module settings"); } ModuleSlotSettingData slotSetting; if (!moduleSetting.TryGetSlotSetting(dropParams.slotType, out slotSetting)) { throw new Exception("not found module slot settings"); } ShipModule module = new ShipModule( dropParams.slotType, Guid.NewGuid().ToString(), dropParams.level, moduleData.Name, dropParams.workshop, moduleData.Id, dropParams.craftingMaterials, dropParams.difficulty); ColorInfo colorInfo = dropParams.resource.ColorRes.Color(ColoredObjectType.Module, dropParams.color); //SelectColor(dropParams.resource); int[] basePoints = Rand.GenerateNumbers(3, dropParams.resource.ModuleSettings.hpSpeedCargoPtMax); module.SetColor(colorInfo.color); module.SetPrefab(moduleData.Model); //module.SetHP(BalanceFormulas.ComputeHP(colorInfo.factor, moduleSetting.base_hp, moduleSetting.base_hp_factor, dropParams.level, basePoints[0], slotSetting.hp_points_value, slotSetting.hp_points_factor) * mHPDiff[dropParams.difficulty]); //module.SetSpeed(BalanceFormulas.ComputeSPEED(colorInfo.factor, moduleSetting.base_speed, moduleSetting.base_speed_factor, dropParams.level, basePoints[1], slotSetting.speed_points_value, slotSetting.speed_points_factor)); //module.SetHold(BalanceFormulas.ComputeCARGO(colorInfo.factor, moduleSetting.base_cargo, moduleSetting.base_cargo_factor, dropParams.level, basePoints[2], slotSetting.cargo_points_value)); module.SetHP(BalanceFormulas.Hp(dropParams.resource.ModuleSettings, slotSetting.hp, dropParams.level, basePoints[0], colorInfo) * dropParams.resource.difficulty.module[dropParams.difficulty]); module.SetSpeed(BalanceFormulas.Speed(dropParams.resource.ModuleSettings, slotSetting.speed, dropParams.level, basePoints[1], colorInfo)); module.SetHold((int)BalanceFormulas.Cargo(dropParams.resource.ModuleSettings, slotSetting.cargo, dropParams.level, basePoints[2], colorInfo)); module.SetCritDamage(BalanceFormulas.CritDamageBonus(dropParams.resource.ModuleSettings, slotSetting.critDamageBonus, dropParams.level, Rand.Int(1, dropParams.resource.ModuleSettings.addPointMax), colorInfo) ); foreach (AdditionalParameter prm in GenerateAdditionalParameters(colorInfo)) { SetAddionalParameter(ref module, dropParams.resource.ModuleSettings, slotSetting, prm, colorInfo); } int[] skills = dropParams.resource.skillDropping.AllowedSkills(dropParams.workshop, dropParams.slotType, dropParams.level); if (skills.Length > 0) { module.SetSkill(skills[Rand.Int(0, skills.Length - 1)]); } else { module.SetSkill(-1); } module.SetSet(dropParams.set); return(module); }