public void GetWeapon() { posX = weapon.localPosition.x; weaponAttributes = weapon.GetComponent <WeaponAttributes>(); attackRangeX = weaponAttributes.attackRangeX; attackRangeY = weaponAttributes.attackRangeY; weaponAttackType = weaponAttributes.weaponAttackType; weaponMass = weaponAttributes.mass; switch (weaponAttributes.weaponUltimate.type) { case WeaponUltimate.Passive: movement.bonusAttributes = weaponAttributes.weaponUltimate.attributes; break; case WeaponUltimate.Buff: break; case WeaponUltimate.Charging: break; case WeaponUltimate.Spell: break; } }
/// <summary> /// Try to give damage to a monster /// </summary> private void DoDamage(bool criticalFist = false) { Rectangle effectiveArea = this.follower.GetBoundingBox(); Rectangle enemyBox = this.leader.GetBoundingBox(); Rectangle companionBox = this.follower.GetBoundingBox(); WeaponAttributes attrs = new WeaponAttributes(); if (!criticalFist && this.weapon != null) { attrs.SetFromWeapon(this.weapon); } if (criticalFist) { attrs.knockBack *= 4; attrs.smashAround /= 2f; } companionBox.Inflate(8, 8); // Personal space effectiveArea.Inflate((int)(effectiveArea.Width * attrs.smashAround + attrs.addedEffectiveArea), (int)(effectiveArea.Height * attrs.smashAround + attrs.addedEffectiveArea)); if (!criticalFist && !this.defendFistUsed && companionBox.Intersects(enemyBox)) { this.ai.Monitor.Log("Critical dangerous: Using defense fists!"); this.defendFistUsed = true; this.DoFightSpeak(); this.DoDamage(true); // Force fist when no damage given to a monster with weapon return; } if (this.follower.currentLocation.damageMonster(effectiveArea, attrs.minDamage, attrs.maxDamage, false, attrs.knockBack, attrs.addedPrecision, attrs.critChance, attrs.critMultiplier, !criticalFist, this.realLeader as Farmer)) { this.follower.currentLocation.playSound("clubhit"); } }
public override void Initialize() { base.Initialize(); //attack = Instantiate(attack); attributes = new WeaponAttributes(); attributes.SetStats(baseAttributes); }
public override void Initialize() { base.Initialize(); projProto = Instantiate(projProto); attributes = new WeaponAttributes(); attributes.SetStats(baseAttributes); ammunitionCount = (int)attributes.GetAttribute(WeaponAttributesType.AmmoCapacity).GetValue(); projProto.speed = (int)attributes.GetAttribute(WeaponAttributesType.ProjectileSpeed).GetValue(); }
public WeaponAttributes giveWeapon(WEAPONS wep, bool addToArray = true) { WeaponAttributes obj = WeaponAttributes.create(wep); if (!obj || !giveWeapon(obj, addToArray)) { Destroy(obj.gameObject); return(null); } return(obj); }
public bool IsLessThan(WeaponAttributes wAtt) { foreach (Elementals e in System.Enum.GetValues(typeof(Elementals))) { if ((elementalAffinities [e.ToString()] as ElementalAffinity).value > (wAtt.elementalAffinities[e.ToString()] as ElementalAffinity).value) { return(false); } } return(true); }
public Weapon(Weapon copiedWeapon) { name = copiedWeapon.name; prefabPoolIndex = copiedWeapon.prefabPoolIndex; weaponAttributes = new WeaponAttributes(copiedWeapon.weaponAttributes); projectileAttributes = new ProjectileAttributes(copiedWeapon.projectileAttributes); clip_Fire = copiedWeapon.clip_Fire; prefab_Projectile = copiedWeapon.prefab_Projectile; }
public void Start() { WeaponAttributes[] preWeps = this.GetComponentsInChildren <WeaponAttributes>(); for (int i = 0; i < preWeps.Length; i++) { weapons.Add(preWeps[i]); } activeWep = weapons[0]; anim = this.GetComponent <Animator>(); move = this.GetComponent <PlayerMovement>(); }
private void iterateWeapon(bool forward) { if (weapons.Count == 0) { return; } int newSlot = activeWepSlot + (forward ? 1 : weapons.Count - 1); newSlot %= weapons.Count; activeWep.gameObject.SetActive(false); activeWep = weapons[newSlot]; activeWepSlot = newSlot; activeWep.gameObject.SetActive(true); }
void Update() { WeaponAttributes wep = Player.getActiveWeapon(); Rect uvrec = img.uvRect; if (!wep) { uvrec.width = 0; img.uvRect = uvrec; return; } uvrec.width = wep.getAmmo(); img.uvRect = uvrec; img.transform.localScale = new Vector3(wep.getAmmo(), 1.0f, 1.0f); img.texture = wep.ammoUI; }
public void GetAttributesFromWeapon() { if (item as Weapon != null) { WeaponAttributes wa = (item as Weapon).attributes; string[] arr = System.Enum.GetNames(typeof(Elementals)); Debug.Log(arr.Length); AttributeUIContainer[] containers = GetAttributeSlots(); for (int i = 0; i < arr.Length; i++) { string element = arr [i]; int value = (wa.elementalAffinities [element] as ElementalAffinity).value; containers [i].attImage.text = element; containers [i].attValue.text = value + ""; } } }
public static WeaponAttributes create(WEAPONS wep) { if (wep < 0 || wep >= WEAPONS.MAX_WEAPONS) { return(null); } WeaponAttributes prefab = (Instantiate(Resources.Load(WEAPON_PATHS[(int)wep], typeof(GameObject))) as GameObject).GetComponent <WeaponAttributes>(); if (!prefab) { return(null); } prefab.type = wep; return(prefab); }
/// <summary> /// Try to give damage to a monster /// </summary> private void DoDamage(bool criticalFist = false) { Rectangle effectiveArea = this.follower.GetBoundingBox(); Rectangle enemyBox = this.leader.GetBoundingBox(); Rectangle companionBox = this.follower.GetBoundingBox(); WeaponAttributes attrs = new WeaponAttributes(); if (!criticalFist && this.weapon != null) { attrs.SetFromWeapon(this.weapon); } if (criticalFist) { attrs.knockBack *= 2.7f; attrs.smashAround /= 2f; } if (criticalFist && this.follower.FacingDirection != 0) { this.follower.currentLocation.playSound("clubSmash"); this.follower.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite("TileSheets\\animations", new Microsoft.Xna.Framework.Rectangle(0, 960, 128, 128), 60f, 4, 0, this.follower.Position, false, this.follower.FacingDirection == 3, 1f, 0.0f, Color.White, .5f, 0.0f, 0.0f, 0.0f, false)); } companionBox.Inflate(8, 8); // Personal space effectiveArea.Inflate((int)(effectiveArea.Width * attrs.smashAround + attrs.addedEffectiveArea), (int)(effectiveArea.Height * attrs.smashAround + attrs.addedEffectiveArea)); if (!criticalFist && !this.defendFistUsed && this.ai.Csm.HasSkill("warrior") && companionBox.Intersects(enemyBox) && Game1.random.NextDouble() < .33f) { this.ai.Monitor.Log("Critical dangerous: Using defense fists!"); this.defendFistUsed = true; this.DoDamage(true); // Force fist when no damage given to a monster with weapon return; } if (this.follower.currentLocation.damageMonster(effectiveArea, attrs.minDamage, attrs.maxDamage, false, attrs.knockBack, attrs.addedPrecision, attrs.critChance, attrs.critMultiplier, !criticalFist, this.realLeader as Farmer)) { this.follower.currentLocation.playSound("clubhit"); if (criticalFist || (Game1.random.NextDouble() > .7f && Game1.random.NextDouble() < .3f)) { this.DoFightSpeak(); } } }
public WeaponAttributesWrapper(WeaponAttributes other) : base(other.Name) { ExcludeFromAutoTargetAcquisition = other.ExcludeFromAutoTargetAcquisition; ExcludeFromAutoFire = other.ExcludeFromAutoFire; ExcludeFromHeightAdvantage = other.ExcludeFromHeightAdvantage; DamageType = other.DamageType; IsTracer = other.IsTracer; TracerSpeed = other.TracerSpeed; TracerLength = other.TracerLength; BaseDamagePerRound = other.BaseDamagePerRound; BaseWreckDamagePerRound = other.BaseWreckDamagePerRound; FiringRecoil = other.FiringRecoil; WindUpTimeMS = other.WindUpTimeMS; RateOfFire = other.RateOfFire; NumberOfBursts = other.NumberOfBursts; DamagePacketsPerShot = other.DamagePacketsPerShot; BurstPeriodMinTimeMS = other.BurstPeriodMinTimeMS; BurstPeriodMaxTimeMS = other.BurstPeriodMaxTimeMS; CooldownTimeMS = other.CooldownTimeMS; WindDownTimeMS = other.WindDownTimeMS; ReloadTimeMS = other.ReloadTimeMS; LineOfSightRequired = other.LineOfSightRequired; LeadsTarget = other.LeadsTarget; KillSkipsUnitDeathSequence = other.KillSkipsUnitDeathSequence; RevealTriggers = other.RevealTriggers; UnitStatusAttackingTriggers = other.UnitStatusAttackingTriggers; TargetStyle = other.TargetStyle; Modifiers = other.Modifiers; AreaOfEffectFalloffType = other.AreaOfEffectFalloffType; AreaOfEffectRadius = other.AreaOfEffectRadius; ExcludeWeaponOwnerFromAreaOfEffect = other.ExcludeWeaponOwnerFromAreaOfEffect; FriendlyFireDamageScalar = other.FriendlyFireDamageScalar; WeaponOwnerFriendlyFireDamageScalar = other.WeaponOwnerFriendlyFireDamageScalar; Turret = other.Turret; Ranges = other.Ranges; ProjectileEntityTypeToSpawn = other.ProjectileEntityTypeToSpawn; StatusEffectsTargetAlignment = other.StatusEffectsTargetAlignment; StatusEffectsExcludeTargetType = other.StatusEffectsExcludeTargetType; ActiveStatusEffectsIndex = other.ActiveStatusEffectsIndex; StatusEffectsSets = other.StatusEffectsSets; EntityTypesToSpawnOnImpact = other.EntityTypesToSpawnOnImpact; TargetPriorizationAttributes = other.TargetPriorizationAttributes; }
private void startHighNoon() { if (charge < 100) { return; } prevWep = player.getActiveWeapon(); if (weapon == null) { weapon = player.giveWeapon(WEAPONS.REVOLVER_GOLDEN, false); } player.setActiveWeapon(weapon); audioSource.pitch = .5f; weapon.setAmmo(weapon.getClipSize());//Force reload startTime = Time.realtimeSinceStartup; Time.timeScale = HNTimeScale; Time.fixedDeltaTime = 0.02f * Time.timeScale; active = true; }
public void dropActiveWeapon() { if (weapons.Count == 0) { return; } activeWep.drop(); weapons.RemoveAt(activeWepSlot); if (weapons.Count > 0) { int newSlot = activeWepSlot % weapons.Count; activeWep = weapons[newSlot]; activeWepSlot = newSlot; activeWep.gameObject.SetActive(true); } else { activeWep = null; } }
public WeaponAttributes(WeaponAttributes copiedWeaponAttributes) { ammoCurrent = copiedWeaponAttributes.ammoCurrent; ammoMax = copiedWeaponAttributes.ammoMax; ammoType = copiedWeaponAttributes.ammoType; consumption = copiedWeaponAttributes.consumption; automatic = copiedWeaponAttributes.automatic; firerate = copiedWeaponAttributes.firerate; timeLastFired = copiedWeaponAttributes.timeLastFired; burstCount = copiedWeaponAttributes.burstCount; burstDelay = copiedWeaponAttributes.burstDelay; projectileSpreads = copiedWeaponAttributes.projectileSpreads; zoomIncrement = copiedWeaponAttributes.zoomIncrement; zoomDecrement = copiedWeaponAttributes.zoomDecrement; zoomCurrent = copiedWeaponAttributes.zoomCurrent; zoomFOVMultiplier = copiedWeaponAttributes.zoomFOVMultiplier; }
public void setActiveWeapon(WeaponAttributes wep) { if (activeWep) { activeWep.gameObject.SetActive(false); } activeWep = wep; if (!wep) { return; } wep.gameObject.SetActive(true); activeWepSlot = 0; for (int i = 0; i < weapons.Count; i++) { if (wep == weapons[i]) { activeWepSlot = i; break; } } }
public bool giveWeapon(WeaponAttributes obj, bool addToArray = true) { if (addToArray && maxWeapons > 0 && weapons.Count >= maxWeapons) { return(false); } Transform trans = this.transform; if (weaponPosition) { trans = weaponPosition.transform; } obj.transform.position = trans.position; obj.transform.rotation = trans.rotation; obj.transform.parent = trans.parent; obj.transform.eulerAngles = trans.eulerAngles; obj.transform.localScale = trans.localScale; obj.setOwner(this); if (weapons.Count > 0) { obj.gameObject.SetActive(false); } else { activeWep = obj; activeWepSlot = 0; } if (addToArray) { weapons.Add(obj); } return(true); }
/// <summary> /// Creates a Hero of a random type with a random weapon. /// </summary> /// <param name="level">Level of the hero</param> /// <returns>Random Hero</returns> private static Hero CreateRandomOpponent(int level) { var rand = new Random(); int type = rand.Next(1, 5); int damage = rand.Next(1, level); double attackSpeed = rand.NextDouble() * (level - 0.1) + 0.1; Weapon weapon = new() { ItemName = "Weapon", ItemLevel = level, ItemSlot = Slot.SLOT_WEAPON, WeaponAttributes = new WeaponAttributes() { Damage = damage, AttackSpeed = attackSpeed } }; Hero opponent; string name = "Opponent"; switch (type) { default: case 1: opponent = new Mage(name); weapon.WeaponType = WeaponType.WEAPON_WAND; break; case 2: opponent = new Ranger(name); weapon.WeaponType = WeaponType.WEAPON_BOW; break; case 3: opponent = new Rogue(name); weapon.WeaponType = WeaponType.WEAPON_DAGGER; break; case 4: opponent = new Warrior(name); weapon.WeaponType = WeaponType.WEAPON_SWORD; break; } if (level > 1) { opponent.LevelUp(level - 1); } try { opponent.Equip(weapon); } catch (Exception e) { GameWriter.ItemEquippedErrorMessage(e.Message); } opponent.CalculateTotalStats(); return(opponent); }
/// <summary> /// Try to give damage to a monster /// </summary> private void DoDamage(bool criticalFist = false) { if (this.leader == null) { return; } Rectangle effectiveArea = this.follower.GetBoundingBox(); Rectangle enemyBox = this.leader.GetBoundingBox(); Rectangle companionBox = this.follower.GetBoundingBox(); this.weaponAttrs = new WeaponAttributes(criticalFist ? null : this.weapon); if (criticalFist) { this.weaponAttrs.knockBack *= 1.7f; this.weaponAttrs.smashAround /= 2f; this.fistCoolDown = 240; } if (this.ai.Csm.HasSkill("warrior")) { // Enhanced skills ONLY for WARRIORS this.weaponAttrs.minDamage += (int)Math.Round(this.weaponAttrs.minDamage * .02f); // 2% added min damage this.weaponAttrs.knockBack += this.weaponAttrs.knockBack * (Game1.random.Next(1, 3) / 100); // 1-3% added knock back this.weaponAttrs.addedEffectiveArea += (int)Math.Round(this.weaponAttrs.addedEffectiveArea * .01f); // 1% added effective area this.weaponAttrs.critChance += Math.Max(0, (float)Game1.player.DailyLuck / 2); // added critical chance is half of daily luck. If luck is negative, no added critical chance } if (criticalFist && this.follower.FacingDirection != 0) { if (!Compat.IsModLoaded(ModUids.PACIFISTMOD_UID)) { this.follower.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite("TileSheets\\animations", new Rectangle(0, 960, 128, 128), 60f, 4, 0, this.follower.Position, false, this.follower.FacingDirection == 3, 1f, 0.0f, Color.White, .5f, 0.0f, 0.0f, 0.0f, false)); } else { this.follower.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Rectangle(211, 428, 7, 6), 2000f, 1, 0, new Vector2((float)this.follower.getTileX(), (float)this.follower.getTileY()) * 64f + new Vector2(16f, -64f), false, false, 1f, 0.0f, Color.White, 4f, 0.0f, 0.0f, 0.0f, false) { motion = new Vector2(0.0f, -0.5f), alphaFade = 0.01f }); } } companionBox.Inflate(4, 4); // Personal space effectiveArea.Inflate((int)(effectiveArea.Width * this.weaponAttrs.smashAround + this.weaponAttrs.addedEffectiveArea), (int)(effectiveArea.Height * this.weaponAttrs.smashAround + this.weaponAttrs.addedEffectiveArea)); if (Compat.IsModLoaded(ModUids.PACIFISTMOD_UID)) { int frame = -1; bool flip = false; if (this.kissFrames.ContainsKey(this.follower.Name)) { frame = int.Parse(this.kissFrames[this.follower.Name].Split(' ')[0]); flip = this.kissFrames[this.follower.Name].Split(' ')[1] == "true"; } this.follower.doEmote(20); } if (!criticalFist && !this.defendFistUsed && this.ai.Csm.HasSkill("warrior") && companionBox.Intersects(enemyBox) && this.weaponSwingCooldown == this.CooldownTimeout && this.fistCoolDown <= 0) { this.ai.Monitor.Log("Critical dangerous: Using defense fists!"); this.defendFistUsed = true; this.DoDamage(true); // Force fist when monster is too close return; } if (this.follower.currentLocation.DamageMonsterByCompanion(effectiveArea, this.weaponAttrs.minDamage, this.weaponAttrs.maxDamage, this.weaponAttrs.knockBack, this.weaponAttrs.addedPrecision, this.weaponAttrs.critChance, this.weaponAttrs.critMultiplier, !criticalFist, this.follower, this.realLeader as Farmer)) { if (criticalFist) { this.follower.currentLocation.playSound(Compat.IsModLoaded(ModUids.PACIFISTMOD_UID) ? "dwop" : "clubSmash"); this.ai.Csm.CompanionManager.Hud.GlowSkill("warrior", Color.Red, 1); this.fistCoolDown = 1200; } if (criticalFist || (Game1.random.NextDouble() > .7f && Game1.random.NextDouble() < .3f)) { this.DoFightSpeak(); } } }
/// <summary> /// Try to give damage to a monster /// </summary> private void DoDamage(bool criticalFist = false) { if (this.leader == null) { return; } Rectangle effectiveArea = this.follower.GetBoundingBox(); Rectangle enemyBox = this.leader.GetBoundingBox(); Rectangle companionBox = this.follower.GetBoundingBox(); WeaponAttributes attrs = new WeaponAttributes(); if (!criticalFist && this.weapon != null) { attrs.SetFromWeapon(this.weapon); } if (criticalFist) { attrs.knockBack *= 3.6f; attrs.smashAround /= 2f; } if (this.ai.Csm.HasSkill("warrior")) { // Enhanced skills ONLY for WARRIORS attrs.minDamage += (int)Math.Round(attrs.minDamage * .03f); // 3% added min damage attrs.knockBack += attrs.knockBack * (Game1.random.Next(2, 5) / 100); // 2-5% added knock back attrs.addedEffectiveArea += (int)Math.Round(attrs.addedEffectiveArea * .01f); // 1% added effective area attrs.critChance += Math.Max(0, (float)Game1.player.DailyLuck / 2); // added critical chance is half of daily luck. If luck is negative, no added critical chance } if (criticalFist && this.follower.FacingDirection != 0) { this.follower.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite("TileSheets\\animations", new Rectangle(0, 960, 128, 128), 60f, 4, 0, this.follower.Position, false, this.follower.FacingDirection == 3, 1f, 0.0f, Color.White, .5f, 0.0f, 0.0f, 0.0f, false)); } companionBox.Inflate(4, 4); // Personal space effectiveArea.Inflate((int)(effectiveArea.Width * attrs.smashAround + attrs.addedEffectiveArea), (int)(effectiveArea.Height * attrs.smashAround + attrs.addedEffectiveArea)); if (!criticalFist && !this.defendFistUsed && this.ai.Csm.HasSkill("warrior") && companionBox.Intersects(enemyBox) && this.weaponSwingCooldown == this.CooldownTimeout) { this.ai.Monitor.Log("Critical dangerous: Using defense fists!"); this.defendFistUsed = true; this.DoDamage(true); // Force fist when no damage given to a monster with weapon return; } if (this.follower.currentLocation.damageMonster(effectiveArea, attrs.minDamage, attrs.maxDamage, false, attrs.knockBack, attrs.addedPrecision, attrs.critChance, attrs.critMultiplier, !criticalFist, this.realLeader as Farmer)) { if (criticalFist) { this.follower.currentLocation.playSound("clubSmash"); this.ai.Csm.CompanionManager.Hud.GlowSkill("warrior", Color.Red, 1); } else { this.follower.currentLocation.playSound("clubhit"); } if (criticalFist || (Game1.random.NextDouble() > .7f && Game1.random.NextDouble() < .3f)) { this.DoFightSpeak(); } } }
private static void ApplyAttribute( WeaponAttributes attrs, int min, int max, WeaponAttribute attr, int low, int high, int scale ) { attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale; }
private static void ApplyAttribute( WeaponAttributes attrs, int min, int max, WeaponAttribute attr, int low, int high ) { attrs[attr] = Scale( min, max, low, high ); }
public bool CheckRequirements(WeaponAttributes wAtt) { return(requirementsMet = upgradeRequirements.IsLessThan(wAtt)); }
private static void ApplyAttribute(WeaponAttributes attrs, int min, int max, WeaponAttribute attr, int low, int high) { attrs[attr] = Scale(min, max, low, high); }
private static void ApplyAttribute(WeaponAttributes attrs, int min, int max, WeaponAttribute attr, int low, int high, int scale) { attrs[attr] = Scale(min, max, low / scale, high / scale) * scale; }
// Token: 0x06000C55 RID: 3157 RVA: 0x00056FE4 File Offset: 0x000551E4 private void UpdateDynamicDataForUnit(Entity entity) { UnitState unitState = ShipbreakersMain.CurrentSimFrame.FindObject <UnitState>(entity); if (unitState == null) { return; } if (this.mSelectedEntity.IsValid()) { if (this.mLastUnitState == unitState) { return; } if (this.mSettings.UnitHealthValueLabel == null || this.mSettings.UnitHealthBar == null || this.mSettings.UnitArmorValueLabel == null || this.mSettings.UnitFireRateLabel == null || this.mSettings.UnitDamageValueLabel == null || this.mSettings.SpeedValueLabel == null || this.mSettings.UnitShortDescriptionValueLabel == null) { Log.Warn(Log.Channel.UI, "Information Panel: An information label was not configured correctly. Check Unity Config. Skipping Info Panel Update", new object[0]); return; } string typeID = unitState.TypeID; bool flag = this.mLastUnitState == null || this.mLastUnitState.EntityID != this.mSelectedEntity; ExperienceViewAttributes entityTypeAttributes = ShipbreakersMain.GetEntityTypeAttributes <ExperienceViewAttributes>(typeID); if (entityTypeAttributes != null) { ExperienceState experienceState = ShipbreakersMain.CurrentSimFrame.FindObject <ExperienceState>(entity); if (experienceState != null && experienceState.Level > 0 && (flag || this.mLastExperienceState == null || this.mLastExperienceState.Level != experienceState.Level)) { if (!string.IsNullOrEmpty(experienceState.NameSuffix)) { RankViewAttributes rankViewAttributes = entityTypeAttributes.RankViews[experienceState.Level]; this.mTempLocalizationFormatObjects[0] = rankViewAttributes.ShortRankName; this.mTempLocalizationFormatObjects[1] = experienceState.NameSuffix; this.mSettings.UnitShortDescriptionValueLabel.text = this.mSettings.UnitLevelFormat.TokenFormat(this.mTempLocalizationFormatObjects, this.mLocMan); } this.mLastExperienceState = experienceState; } } if (flag || unitState.OwnerCommander != this.mLastUnitState.OwnerCommander) { Commander commanderFromID = this.mCommanderManager.GetCommanderFromID(unitState.OwnerCommander); CommanderDirectorAttributes commanderDirectorFromID = this.mCommanderManager.GetCommanderDirectorFromID(unitState.OwnerCommander); this.mTempLocalizationFormatObjects[0] = ((commanderFromID != null) ? SharedLocIDConstants.GetLocalizedCommanderName(commanderDirectorFromID.PlayerType, commanderFromID.Name, commanderDirectorFromID.AIDifficulty) : string.Empty); this.mTempLocalizationFormatObjects[1] = null; this.mSettings.PlayerNameLabel.text = this.mSettings.PlayerNameLocID.TokenFormat(this.mTempLocalizationFormatObjects, this.mLocMan); } UnitAttributes typeAttributes = this.mSelectedEntity.GetTypeAttributes <UnitAttributes>(); if (typeAttributes == null) { Log.Warn(Log.Channel.UI, "Information Panel: Attribute data was missing for unit type {0}. Skipping info panel update", new object[] { this.mSelectedEntity.ToFriendlyString() }); return; } UnitAttributes entityTypeAttributes2 = ShipbreakersMain.GetEntityTypeAttributes <UnitAttributes>(typeID); if (entityTypeAttributes2 == null) { Log.Error(Log.Channel.Data | Log.Channel.UI, "Failed to find base UnitAttributes for entity type {0}", new object[] { typeID }); } if (flag || unitState.Hitpoints != this.mLastUnitState.Hitpoints) { this.mTempLocalizationFormatObjects[0] = unitState.Hitpoints; this.mTempLocalizationFormatObjects[1] = unitState.MaxHitpoints; this.mSettings.UnitHealthValueLabel.text = ((unitState.MaxHitpoints > 0) ? this.mSettings.UnitHealthFormat.TokenFormat(this.mTempLocalizationFormatObjects, this.mLocMan) : string.Empty); this.mSettings.UnitHealthBar.value = ((unitState.MaxHitpoints > 0) ? ((float)unitState.Hitpoints / (float)unitState.MaxHitpoints) : 0f); int buffComparison = 0; if (entityTypeAttributes2 != null) { buffComparison = unitState.MaxHitpoints.CompareTo(entityTypeAttributes2.MaxHealth); } this.mSettings.UnitHealthValueLabel.color = this.mUnitInteractionAttributes.BuffInfo.BuffColor(buffComparison); } this.mSelectedEntity.GetTypeAttributes <UnitMovementAttributes>(); int num = Fixed64.IntValue(unitState.MaxSpeed); if (flag || num != Fixed64.IntValue(this.mLastUnitState.MaxSpeed)) { this.mTempLocalizationFormatObjects[0] = num; this.mTempLocalizationFormatObjects[1] = null; this.mSettings.SpeedValueLabel.text = this.mSettings.UnitSpeedFormat.TokenFormat(this.mTempLocalizationFormatObjects, this.mLocMan); int buffComparison2 = 0; UnitMovementAttributes entityTypeAttributes3 = ShipbreakersMain.GetEntityTypeAttributes <UnitMovementAttributes>(typeID); UnitDynamicsAttributes unitDynamicsAttributes = (entityTypeAttributes3 != null) ? entityTypeAttributes3.Dynamics : null; if (unitDynamicsAttributes != null) { buffComparison2 = unitState.MaxSpeed.CompareTo(unitDynamicsAttributes.MaxSpeed); } else { Log.Error(Log.Channel.Data | Log.Channel.UI, "Failed to find base UnitDynamicsAttributes for entity type {0}", new object[] { typeID }); } this.mSettings.SpeedValueLabel.color = this.mUnitInteractionAttributes.BuffInfo.BuffColor(buffComparison2); } int buffComparison3 = 0; // MOD int baseDamagePerRound = 0; int damagePacketsPerShot = 1; // MOD if (!typeAttributes.WeaponLoadout.IsNullOrEmpty <WeaponBinding>()) { WeaponBinding weaponBinding = typeAttributes.WeaponLoadout[0]; if (weaponBinding != null) { // MOD damagePacketsPerShot = weaponBinding.Weapon.DamagePacketsPerShot; baseDamagePerRound = Fixed64.IntValue(weaponBinding.Weapon.BaseDamagePerRound); WeaponAttributes entityTypeAttributes4 = ShipbreakersMain.GetEntityTypeAttributes <WeaponAttributes>(typeID, weaponBinding.Weapon.Name); if (entityTypeAttributes4 != null) { buffComparison3 = baseDamagePerRound.CompareTo(Fixed64.IntValue(entityTypeAttributes4.BaseDamagePerRound)); } else { Log.Error(Log.Channel.Data | Log.Channel.UI, "Failed to find base WeaponAttributes with name {0} for entity type {1}", new object[] { weaponBinding.Weapon.Name, typeID }); } // MOD } else { Log.Error(Log.Channel.Data | Log.Channel.UI, "First WeaponBinding in WeaponLoadout for unit type {0} is null! Unable to determine damage to show on info panel", new object[] { typeID }); } } // MOD if (flag || this.mLastWeaponDamageValue != baseDamagePerRound || this.mLastWeaponPacketsValue != damagePacketsPerShot) { this.mSettings.UnitDamageValueLabel.text = damagePacketsPerShot != 1 ? string.Format("{0} | {1}", baseDamagePerRound, damagePacketsPerShot) : string.Format("{0}", baseDamagePerRound); this.mLastWeaponDamageValue = baseDamagePerRound; this.mLastWeaponPacketsValue = damagePacketsPerShot; this.mSettings.UnitDamageValueLabel.color = this.mUnitInteractionAttributes.BuffInfo.BuffColor(buffComparison3); } // MOD if (flag || this.mLastUnitArmourValue != typeAttributes.Armour) { this.mTempLocalizationFormatObjects[0] = typeAttributes.Armour; this.mTempLocalizationFormatObjects[1] = null; this.mSettings.UnitArmorValueLabel.text = this.mSettings.UnitArmorFormat.TokenFormat(this.mTempLocalizationFormatObjects, this.mLocMan); this.mLastUnitArmourValue = typeAttributes.Armour; int buffComparison4 = 0; if (entityTypeAttributes2 != null) { buffComparison4 = typeAttributes.Armour.CompareTo(entityTypeAttributes2.Armour); } this.mSettings.UnitArmorValueLabel.color = this.mUnitInteractionAttributes.BuffInfo.BuffColor(buffComparison4); } if (flag || this.mLastFireRateDisplay != typeAttributes.FireRateDisplay) { this.mTempLocalizationFormatObjects[0] = InformationPanelController.InformationPanelSettings.FireRateLocIDs[typeAttributes.FireRateDisplay]; this.mTempLocalizationFormatObjects[1] = null; this.mSettings.UnitFireRateLabel.text = this.mSettings.UnitFireRateFormat.TokenFormat(this.mTempLocalizationFormatObjects, this.mLocMan); this.mLastFireRateDisplay = typeAttributes.FireRateDisplay; int buffComparison5 = 0; if (entityTypeAttributes2 != null) { buffComparison5 = typeAttributes.FireRateDisplay.CompareTo(entityTypeAttributes2.FireRateDisplay); } this.mSettings.UnitFireRateLabel.color = this.mUnitInteractionAttributes.BuffInfo.BuffColor(buffComparison5); } this.mLastUnitState = unitState; } }
public Weapon(string ItemName, int ItemLevel, ArmorSlots ItemSlot, WeaponTypes WeaponType, WeaponAttributes WeaponAttributes) : base(ItemName, ItemLevel, ItemSlot) { this.WeaponType = WeaponType; this.WeaponAttributes = WeaponAttributes; }
protected void OutputForWeapons(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes, string[] selectedWeapons, bool dps = false) { using (BeginScope("weapons")) { WeaponAttributes[] weaponAttributes = entityTypeAttributes.GetAll <WeaponAttributes>(); for (int i = 0; i < weaponAttributes.Length; ++i) { WeaponAttributes w = weaponAttributes[i]; if (selectedWeapons == null || Array.IndexOf(selectedWeapons, w.Name) >= 0) { using (BeginScope(w.Name)) { Print($"damageType: {w.DamageType}"); Print($"dmg: {w.BaseDamagePerRound}"); Print($"packets: {w.DamagePacketsPerShot}"); Print($"excludeFromHighGround: {w.ExcludeFromHeightAdvantage}"); Print($"lineOfSightRequired: {w.LineOfSightRequired}"); Print($"friendlyFireDamageScalar: {w.FriendlyFireDamageScalar}"); Print($"leadsTarget: {w.LeadsTarget}"); Print($"windUp: {w.WindUpTimeMS}"); Print($"windDown: {w.WindDownTimeMS}"); Print($"rof: {w.RateOfFire}"); Print($"burstMin: {w.BurstPeriodMinTimeMS}"); Print($"burstMax: {w.BurstPeriodMaxTimeMS}"); Print($"numBursts: {w.NumberOfBursts}"); Print($"cooldown: {w.CooldownTimeMS}"); Print($"reload: {w.ReloadTimeMS}"); Print($"aoe: {w.AreaOfEffectRadius}"); Print($"falloff: {Enum.GetName(typeof(AOEFalloffType), w.AreaOfEffectFalloffType)}"); using (BeginScope($"ranges")) { foreach (var r in w.Ranges) { using (BeginScope(Enum.GetName(typeof(WeaponRange), r.Range))) { Print($"distance: {r.Distance}"); Print($"accuracy: {r.Accuracy}"); } } } if (!dps) { using (BeginScope($"turret")) { Print($"fieldOfView: {w.Turret.FieldOfView}"); Print($"fieldOfFire: {w.Turret.FieldOfFire}"); Print($"rotationSpeed: {w.Turret.RotationSpeed}"); } if (w.Modifiers.Length > 0) { using (BeginScope($"modifiers")) { for (int j = 0; j < w.Modifiers.Length; ++j) { WeaponModifierInfo modifierInfo = w.Modifiers[j]; using (BeginScope(j.ToString())) { Print($"targetClass: {modifierInfo.TargetClass}"); Print($"classOperator: {modifierInfo.ClassOperator}"); Print($"modifierType: {modifierInfo.Modifier}"); Print($"amount: {modifierInfo.Amount}"); } } } } if (w.StatusEffectsSets.Length > 0) { Print($"statusEffectsExcludeTargetType: {w.StatusEffectsExcludeTargetType}"); Print($"statusEffectsTargetAlignment: {w.StatusEffectsTargetAlignment}"); using (BeginScope("statusEffectSets")) { for (int j = 0; j < w.StatusEffectsSets.Length; ++j) { for (int k = 0; k < w.StatusEffectsSets[j].StatusEffects.Length; ++k) { using (BeginScope(w.StatusEffectsSets[j].StatusEffects[k])) { EntityTypeAttributes seEntityTypeAttributes = entityTypeCollection.GetEntityType(w.StatusEffectsSets[j].StatusEffects[k]); StatusEffectAttributes[] statusEffectAttributes = seEntityTypeAttributes.GetAll <StatusEffectAttributes>(); if (statusEffectAttributes.Length > 0) { OutputForStatusEffect(statusEffectAttributes[0]); } } } } } } } WeaponDPSInfo weaponDPSInfo = new WeaponDPSInfo(w); using (BeginScope("dpsInfo")) { Print($"avgShots: {weaponDPSInfo.AverageShotsPerBurst}"); Print($"trueROF: {weaponDPSInfo.TrueROF}"); Print($"sequenceDuration: {weaponDPSInfo.SequenceDuration}"); if (dps) { using (BeginScope("dpsVsArmor")) { int[] armorVals = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 18, 21, 25, 50, 75, 100 }; for (int j = 0; j < armorVals.Length; ++j) { using (BeginScope(armorVals[j].ToString())) { double armorDPS = weaponDPSInfo.ArmorDPS(armorVals[j]); Print($"dpsBeforeAccuracy: {armorDPS}"); using (BeginScope("accuracyDps")) { Dictionary <WeaponRange, double> rangeDPS = weaponDPSInfo.RangeDPS(armorDPS); foreach (RangeBasedWeaponAttributes r in w.Ranges) { Print($"{Enum.GetName(typeof(WeaponRange), r.Range)}: {rangeDPS[r.Range]}"); } } } } } } else { double armorDPS = weaponDPSInfo.ArmorDPS(0); Print($"dpsBeforeAccuracy: {armorDPS}"); using (BeginScope("accuracyDps")) { Dictionary <WeaponRange, double> rangeDPS = weaponDPSInfo.RangeDPS(armorDPS); foreach (RangeBasedWeaponAttributes r in w.Ranges) { Print($"{Enum.GetName(typeof(WeaponRange), r.Range)}: {rangeDPS[r.Range]}"); } } } } } } } } }
public static void ApplyAttributesTo(BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max) { m_IsRunicTool = isRunicTool; m_LuckChance = luckChance; MagicalAttributes primary = weapon.Attributes; WeaponAttributes secondary = weapon.WeaponAttributes; ElementAttributes resistances = weapon.Resistances; m_Props.SetAll(false); if (weapon is BaseRanged || weapon is BaseThrowing) { m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon } if (!(weapon is BaseRanged)) { m_Props.Set(28, true); // Solo los arcos pueden llevar la propiedad Balanced m_Props.Set(29, true); // Solo los arcos pueden llevar la propiedad Velocity } if (isRunicTool) { m_Props.Set(16, true); // Lower requirements don't spawn from runic tools } bool isRunicToolRanged = isRunicTool && weapon is BaseRanged; for (int i = 0; i < attributeCount; ++i) { int random = GetUniqueRandom(30); if (random == -1) { break; } switch (random) { case 0: { switch (Utility.Random(5)) { case 0: ApplyAttribute(secondary, min, max, WeaponAttribute.HitPhysicalArea, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, WeaponAttribute.HitFireArea, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, WeaponAttribute.HitColdArea, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, WeaponAttribute.HitPoisonArea, 2, 50, 2); break; case 4: ApplyAttribute(secondary, min, max, WeaponAttribute.HitEnergyArea, 2, 50, 2); break; } break; } case 1: { switch (Utility.Random(4)) { case 0: ApplyAttribute(secondary, min, max, WeaponAttribute.HitMagicArrow, 2, 50, 2); break; case 1: ApplyAttribute(secondary, min, max, WeaponAttribute.HitHarm, 2, 50, 2); break; case 2: ApplyAttribute(secondary, min, max, WeaponAttribute.HitFireball, 2, 50, 2); break; case 3: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLightning, 2, 50, 2); break; } break; } case 2: { switch (Utility.Random(2)) { case 0: ApplyAttribute(secondary, min, max, WeaponAttribute.UseBestSkill, 1, 1); break; case 1: ApplyAttribute(secondary, min, max, WeaponAttribute.MageWeapon, 1, 10); break; } break; } case 3: { MagicalAttribute attr = MagicalAttribute.WeaponDamage; int oldValue = primary[attr]; ApplyAttribute(primary, min, max, attr, 1, 50); if (oldValue >= primary[attr]) { primary[attr] = oldValue; i--; } break; } case 4: ApplyAttribute(primary, min, max, MagicalAttribute.DefendChance, 1, isRunicToolRanged ? 25 : 15); break; case 5: ApplyAttribute(primary, min, max, MagicalAttribute.CastSpeed, 1, 1); break; case 6: ApplyAttribute(primary, min, max, MagicalAttribute.AttackChance, 1, isRunicToolRanged ? 25 : 15); break; case 7: ApplyAttribute(primary, min, max, MagicalAttribute.Luck, 1, isRunicToolRanged ? 120 : 100); break; case 8: ApplyAttribute(primary, min, max, MagicalAttribute.WeaponSpeed, 5, 30, 5); break; case 9: ApplyAttribute(primary, min, max, MagicalAttribute.SpellChanneling, 1, 1); break; case 10: ApplyAttribute(secondary, min, max, WeaponAttribute.HitDispel, 2, 50, 2); break; case 11: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLeechHits, 2, 50, 2); break; case 12: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLowerAttack, 2, 50, 2); break; case 13: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLowerDefend, 2, 50, 2); break; case 14: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLeechMana, 2, 50, 2); break; case 15: ApplyAttribute(secondary, min, max, WeaponAttribute.HitLeechStam, 2, 50, 2); break; case 16: ApplyAttribute(secondary, min, max, WeaponAttribute.LowerStatReq, 10, 100, 10); break; case 17: ApplyAttribute(resistances, min, max, ElementAttribute.Physical, 1, 15); break; case 18: ApplyAttribute(resistances, min, max, ElementAttribute.Fire, 1, 15); break; case 19: ApplyAttribute(resistances, min, max, ElementAttribute.Cold, 1, 15); break; case 20: ApplyAttribute(resistances, min, max, ElementAttribute.Poison, 1, 15); break; case 21: ApplyAttribute(resistances, min, max, ElementAttribute.Energy, 1, 15); break; case 22: ApplyAttribute(secondary, min, max, WeaponAttribute.DurabilityBonus, 10, 100, 10); i--; break; case 23: SlayerName slayer = GetRandomSlayer(); if (weapon.Slayer == SlayerName.None) { weapon.Slayer = slayer; } else { weapon.Slayer2 = slayer; } break; case 24: AssignElementalDamage(weapon, ElementAttribute.Fire); i--; break; case 25: AssignElementalDamage(weapon, ElementAttribute.Cold); i--; break; case 26: AssignElementalDamage(weapon, ElementAttribute.Poison); i--; break; case 27: AssignElementalDamage(weapon, ElementAttribute.Energy); i--; break; case 28: ApplyAttribute(secondary, min, max, WeaponAttribute.Balanced, 1, 1); break; case 29: ApplyAttribute(secondary, min, max, WeaponAttribute.Velocity, 10, 50, 1); break; } } }
public void SetWeaponSelected(WeaponAttributes weapon) { weaponToBuild = weapon; }
public void SetAttributes(WeaponAttributes inAttributes) { attributes = inAttributes; }