/// <summary> /// in addition to spawning the projectile in the base class, /// plays a fire animation on the weapon and applies recoil /// to the weapon spring. also regulates tap fire /// </summary> protected override void Fire() { m_LastFireTime = Time.time; // play fire animation if (AnimationFire != null) { if (WeaponAnimation[AnimationFire.name] == null) { Debug.LogError("Error (" + this + ") No animation named '" + AnimationFire.name + "' is listed in this prefab. Make sure the prefab has an 'Animation' component which references all the clips you wish to play on the weapon."); } else { WeaponAnimation[AnimationFire.name].time = 0.0f; WeaponAnimation.Sample(); WeaponAnimation.Play(AnimationFire.name); } } // apply recoil if (MotionRecoilDelay == 0.0f) { ApplyRecoil(); } else { vp_Timer.In(MotionRecoilDelay, ApplyRecoil); } base.Fire(); }
public override WeaponAnimation GetAnimation() { WeaponAnimation animation = WeaponAnimation.Slash1H; Mobile attacker = this.Parent as Mobile; if (attacker != null) { if (attacker.FindItemOnLayer(Layer.TwoHanded) != null) { switch (Utility.RandomMinMax(1, 4)) { case 1: animation = WeaponAnimation.Bash2H; break; case 2: animation = WeaponAnimation.Bash2H; break; case 3: animation = WeaponAnimation.Slash2H; break; case 4: animation = WeaponAnimation.Pierce2H; break; } } } return(animation); }
protected void SetupWeaponAnim() { if (WorldObject == null) { return; } for (int i = 0; i < WorldObject.transform.childCount; i++) { Transform child = WorldObject.transform.GetChild(i); if (child.name.Contains("WeaponPlane")) { for (int j = 0; j < child.transform.childCount; j++) { Transform meshChild = child.GetChild(j); WeaponAnim = meshChild.GetComponent <WeaponAnimation>(); if (WeaponAnim == null) { return; } } } } SetWeaponSprites(); }
void OnEquipmentChanged(Equipment newItem, Equipment oldItem) { if (oldItem != null) { if (oldItem.equipSlot == EquipmentSlot.Weapon) { animator.SetLayerWeight(1, 0); // right hand grip full weight } if (oldItem.equipSlot == EquipmentSlot.Shield) { animator.SetLayerWeight(2, 0); // left hand grip full weight } } if (newItem != null) { if (newItem.equipSlot == EquipmentSlot.Weapon) { WeaponAnimation newC = weaponAnimations.First(x => x.weapons.Contains(newItem)); if (newC != null) { currentWeaponAnimation = newC; } animator.SetLayerWeight(1, 1); // right hand grip full weight } if (newItem.equipSlot == EquipmentSlot.Shield) { animator.SetLayerWeight(2, 1); // left hand grip full weight } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); m_GastroAnimation = WeaponAnimation.Slash1H; }
public void Dequip() { isEquipped = false; weapAnim = null; transform.parent = null; rigid.constraints = RigidbodyConstraints.None; rigid.AddForce(Vector3.forward * 3); }
private void AlignLeft(WeaponAnimation anim, int width, int height) { weaponPosition = new Rect( Screen.width * anim.Offset, Screen.height - height * weaponScaleY, width * weaponScaleX, height * weaponScaleY); }
private void AlignCenter(WeaponAnimation anim, int width, int height) { weaponPosition = new Rect( screenRect.x + screenRect.width / 2f - (width * weaponScaleX) / 2f, screenRect.y + screenRect.height - height * weaponScaleY - weaponOffsetHeight, width * weaponScaleX, height * weaponScaleY); }
private void AlignCenter(WeaponAnimation anim, int width, int height) { weaponPosition = new Rect( Screen.width / 2f - (width * weaponScaleX) / 2f, Screen.height - height * weaponScaleY, width * weaponScaleX, height * weaponScaleY); }
private void AlignLeft(WeaponAnimation anim, int width, int height) { weaponPosition = new Rect( screenRect.x + screenRect.width * anim.Offset, screenRect.y + screenRect.height - height * weaponScaleY - weaponOffsetHeight, width * weaponScaleX, height * weaponScaleY); }
public void setupDefaultAnimations() { Animation.initialize(); Animation.s_animations.Add("UNIT-CHARGE-EXPLODE", new Animation("UNIT-CHARGE-EXPLODE", Content.Load <Texture2D>("UM_CenterFlashTest"), 8, 1, 1.0f)); WeaponAnimation.initialize(); WeaponAnimation.s_animations.Add("WEAPON-SPRITE-WARHAMMER", new WeaponAnimation("WEAPON-SPRITE-WARHAMMER", Content.Load <Texture2D>("W_TestHammer"), 16, 4, 6.0f)); }
protected virtual void InitializeAnimationProperties(string mount, float rateOfFire, int numberOfProj, string projectileName = null) { m_WeaponAnimation = transform.GetComponent <WeaponAnimation> (); m_WeaponAnimation.SetWeapon(this); m_WeaponAnimation.SetMount(mount); m_WeaponAnimation.SetRateOfFire(rateOfFire); m_WeaponAnimation.SetNumberOfProj(numberOfProj); m_WeaponAnimation.SetProjectilePrefab(Resources.Load("Prefab/Projectiles/" + projectileName) as GameObject); }
public Weapon(Weapon w) { m_name = w.m_name; m_animation = WeaponAnimation.getAnimation(w.m_animation.m_animationName); m_color = w.m_color; m_stats = new Dictionary <string, int>(w.m_stats); m_swingCount = w.m_swingCount; m_swingData = new List <Dictionary <string, float> >(w.m_swingData); }
// Use this for initialization void Start() { // in the start of the game the player hold this weapon CrossHair.SetActive(false); gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; _PlayerShoot = gameObject.GetComponent <PlayerShoot>(); StartCoroutine(WaitTime(1.5f)); updateAnimator = GetComponent <WeaponAnimation>(); }
public static void SFCreate_Callback(Tuple <int, Mobile, IPoint3D> obj) { int sequence = obj.Item1; Mobile m = obj.Item2; IPoint3D p = obj.Item3; WeaponAnimation animation = ((BaseWeapon)m.Weapon).Animation; switch (sequence) { case 0: { m.Animate((int)animation, 7, 1, true, false, 0); m.PrivateOverheadMessage(MessageType.Label, 2049, true, "*You create the base of the Soulforge using mundane materials and the ground dragonbone shards*", m.NetState); Timer.DelayCall(TimeSpan.FromSeconds(4), SFCreate_Callback, Tuple.Create(1, m, p)); break; } case 1: { m.Animate((int)animation, 7, 1, true, false, 0); m.PrivateOverheadMessage(MessageType.Label, 2049, true, "*You gently place the intact dragon hearts in the middle of the forge*", m.NetState); Timer.DelayCall(TimeSpan.FromSeconds(4), SFCreate_Callback, Tuple.Create(2, m, p)); break; } case 2: { m.Animate((int)animation, 7, 1, true, false, 0); m.PrivateOverheadMessage(MessageType.Label, 2049, true, "*You place both the soul of the Devourer and the soul of the Harrower into the forge*", m.NetState); Timer.DelayCall(TimeSpan.FromSeconds(4), SFCreate_Callback, Tuple.Create(3, m, p)); break; } case 3: { m.Animate((int)animation, 7, 1, true, false, 0); m.PrivateOverheadMessage(MessageType.Label, 2049, true, "*You throw the heart of Rikktor, the dragon-king, into the forge*", m.NetState); List <Mobile> list = m.GetMobilesInRange(m.Map, 30).Where(mob => mob != null && !mob.Deleted && mob.Player).ToList(); foreach (Mobile player in list) { Effects.SendIndividualFlashEffect(player, (FlashType)2); } FlameSpiral(new Point3D(p), Map.Felucca); m.Frozen = false; break; } } }
public GastroFork() { Name = "Gastro Fork"; Hue = 2075; Attributes.WeaponDamage = 30; Attributes.WeaponSpeed = 25; WeaponAttributes.SelfRepair = 1; m_GastroAnimation = WeaponAnimation.Slash1H; // WeaponAttributes.HitLeechMana = 40; }
public GastroFork() { Name = "Gastro Fork"; Hue = 2075; Attributes.WeaponDamage = 30; Attributes.WeaponSpeed = 25; WeaponAttributes.SelfRepair = 1; m_GastroAnimation = WeaponAnimation.Slash1H; // WeaponAttributes.HitLeechMana = 40; }
// Use this for initialization private void Start() { fireReady = true; fireInterval = 60f / weaponInfo.rpm; firePos = GameObject.FindGameObjectWithTag("MainCamera").transform; playerInventory = GetComponentInParent <PlayerInventory>(); gunAnimation = GetComponent <WeaponAnimation>(); ammosToReload = 0; status = GetComponentInParent <FirstPersonController>(); playerUIController = GetComponentInParent <PlayerUIController>(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); reader.GetVersion(); TransmuteID = reader.ReadInt(); TransmuteHue = reader.ReadInt(); TransmuteAnimation = (WeaponAnimation)reader.ReadInt(); TransmuteName = reader.ReadString(); }
public static void addNewWeaponTemplate(String name, Color color, WeaponAnimation tex, Dictionary <String, int> stats) { if (s_weaponTemplates == null) { s_weaponTemplates = new Dictionary <string, Weapon>(); } Weapon w = new Weapon(name, tex); w.m_color = color; w.m_stats = stats; w.m_swingData = new List <Dictionary <String, float> >(); s_weaponTemplates.Add(name, w); }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (compo == null) { compo = animator.GetComponent <WeaponAnimation>(); } if (stateInfo.normalizedTime > timer) { timer += 0.95f; compo.ReloadShell(); } }
private void AlignRight(WeaponAnimation anim, int width, int height) { if (FlipHorizontal && (weaponState == WeaponStates.Idle || weaponState == WeaponStates.StrikeDown || weaponState == WeaponStates.StrikeUp)) { // Flip alignment AlignLeft(anim, width, height); return; } weaponPosition = new Rect( Screen.width * (1f - anim.Offset) - width * weaponScaleX, Screen.height - height * weaponScaleY, width * weaponScaleX, height * weaponScaleY); }
public override bool CheckHit( Mobile attacker, Mobile defender ) { switch( m_GastroAnimation ) { case WeaponAnimation.Slash1H: m_GastroAnimation = WeaponAnimation.Pierce1H; break; case WeaponAnimation.Pierce1H: m_GastroAnimation = WeaponAnimation.Bash1H; break; case WeaponAnimation.Bash1H: m_GastroAnimation = WeaponAnimation.Slash1H; break; } if ( base.CheckHit( attacker, defender ) ) return true; else if ( m_GastroAnimation == WeaponAnimation.Pierce1H ) return true; else return false; }
public void Equip(WeaponAnimation newWeapAnim) { weapAnim = newWeapAnim; //this conditional is really only for the initial equip if (weapAnim.GetWeap() != this) { weapAnim.GetWeap().Dequip(); } newWeapAnim.SetWeapon(this); isEquipped = true; rigid.constraints = RigidbodyConstraints.FreezeAll; transform.parent = weapAnim.transform; transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.Euler(Vector3.zero); }
public override WeaponAnimation GetAnimation() { WeaponAnimation animation = WeaponAnimation.Wrestle; switch (Utility.Random(7)) { case 0: animation = WeaponAnimation.Wrestle; break; case 1: animation = WeaponAnimation.Wrestle; break; case 2: animation = WeaponAnimation.Slash1H; break; case 3: animation = WeaponAnimation.Pierce1H; break; case 4: animation = WeaponAnimation.Bash1H; break; case 5: animation = WeaponAnimation.Block; break; case 6: animation = WeaponAnimation.Pierce2H; break; } return(animation); }
public override bool CheckHit(Mobile attacker, Mobile defender) { switch (m_GastroAnimation) { case WeaponAnimation.Slash1H: m_GastroAnimation = WeaponAnimation.Pierce1H; break; case WeaponAnimation.Pierce1H: m_GastroAnimation = WeaponAnimation.Bash1H; break; case WeaponAnimation.Bash1H: m_GastroAnimation = WeaponAnimation.Slash1H; break; } if (base.CheckHit(attacker, defender)) { return(true); } else if (m_GastroAnimation == WeaponAnimation.Pierce1H) { return(true); } else { return(false); } }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); SaveFlag flags = (SaveFlag)reader.ReadInt(); switch ( version ) { case 8: { // turnned off AOS attributes goto case 7; } case 7: { goto case 6; } case 6: { goto case 5; } case 5: { if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) ) m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) ) m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) ) m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Quality ) ) m_Quality = (WeaponQuality)reader.ReadInt(); else m_Quality = WeaponQuality.Regular; if ( GetSaveFlag( flags, SaveFlag.Hits ) ) m_Hits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.MaxHits ) ) m_MaxHits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Slayer ) ) m_Slayer = (SlayerName)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Poison ) ) m_Poison = Poison.Deserialize( reader ); if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) ) m_PoisonCharges = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) m_Crafter = reader.ReadMobile(); if ( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 6 || reader.ReadBool() ); if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadInt(); else m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadInt(); else m_DexReq = -1; if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadInt(); else m_IntReq = -1; if ( GetSaveFlag( flags, SaveFlag.MinDamage ) ) m_MinDamage = reader.ReadInt(); else m_MinDamage = -1; if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) ) m_MaxDamage = reader.ReadInt(); else m_MaxDamage = -1; if ( GetSaveFlag( flags, SaveFlag.HitSound ) ) m_HitSound = reader.ReadInt(); else m_HitSound = -1; if ( GetSaveFlag( flags, SaveFlag.MissSound ) ) m_MissSound = reader.ReadInt(); else m_MissSound = -1; if ( GetSaveFlag( flags, SaveFlag.Speed ) ) m_Speed = reader.ReadInt(); else m_Speed = -1; if ( GetSaveFlag( flags, SaveFlag.MaxRange ) ) m_MaxRange = reader.ReadInt(); else m_MaxRange = -1; if ( GetSaveFlag( flags, SaveFlag.Skill ) ) m_Skill = (SkillName)reader.ReadInt(); else m_Skill = (SkillName)(-1); if ( GetSaveFlag( flags, SaveFlag.Type ) ) m_Type = (WeaponType)reader.ReadInt(); else m_Type = (WeaponType)(-1); if ( GetSaveFlag( flags, SaveFlag.Animation ) ) m_Animation = (WeaponAnimation)reader.ReadInt(); else m_Animation = (WeaponAnimation)(-1); if ( GetSaveFlag( flags, SaveFlag.Resource ) ) m_Resource = (CraftResource)reader.ReadInt(); else m_Resource = CraftResource.Iron; // obsolete from version 8 on if (version < 8) { AosAttributes dmy_AosAttributes; AosWeaponAttributes dmy_AosWeaponAttributes; if ( GetSaveFlag( flags, SaveFlag.xAttributes ) ) dmy_AosAttributes = new AosAttributes( this, reader ); //else //dmy_AosAttributes = new AosAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) ) dmy_AosWeaponAttributes = new AosWeaponAttributes( this, reader ); //else //dmy_AosWeaponAttributes = new AosWeaponAttributes( this ); } if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( SkillName.Tactics, true, (int)m_AccuracyLevel * 5 ); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } /*if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && Parent is Mobile ) { m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -m_AosWeaponAttributes.MageWeapon ); ((Mobile)Parent).AddSkillMod( m_MageMod ); }*/ // erl: made obsolete by PlayerCrafted in version 9 //if (version < 9) //{ //if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) //PlayerCrafted = true; //} break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if ( version == 0 ) m_MaxRange = 1; // default if ( version < 5 ) { m_Resource = CraftResource.Iron; //m_AosAttributes = new AosAttributes( this ); //m_AosWeaponAttributes = new AosWeaponAttributes( this ); } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize( reader ); m_PoisonCharges = reader.ReadInt(); if ( m_StrReq == OldStrengthReq ) m_StrReq = -1; if ( m_DexReq == OldDexterityReq ) m_DexReq = -1; if ( m_IntReq == OldIntelligenceReq ) m_IntReq = -1; if ( m_MinDamage == OldMinDamage ) m_MinDamage = -1; if ( m_MaxDamage == OldMaxDamage ) m_MaxDamage = -1; if ( m_HitSound == OldHitSound ) m_HitSound = -1; if ( m_MissSound == OldMissSound ) m_MissSound = -1; if ( m_Speed == OldSpeed ) m_Speed = -1; if ( m_MaxRange == OldMaxRange ) m_MaxRange = -1; if ( m_Skill == OldSkill ) m_Skill = (SkillName)(-1); if ( m_Type == OldType ) m_Type = (WeaponType)(-1); if ( m_Animation == OldAnimation ) m_Animation = (WeaponAnimation)(-1); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( SkillName.Tactics, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } break; } } /* int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) ) { Mobile m = (Mobile)this.Parent; string modName = this.Serial.ToString(); if ( strBonus != 0 ) m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) ); if ( dexBonus != 0 ) m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) ); if ( intBonus != 0 ) m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) ); } */ if ( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); if ( m_Hits <= 0 && m_MaxHits <= 0 ) { m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); } //if ( version < 6 ) //PlayerCrafted = true; // we don't know, so, assume it's crafted }
public void SwingAnimation(Mobile m) { if (m == null || m.Weapon == null || !(m.Weapon is BaseWeapon)) { return; } int action; WeaponAnimation animation = ((BaseWeapon)m.Weapon).Animation; switch (m.Body.Type) { case BodyType.Sea: case BodyType.Animal: action = Utility.Random(5, 2); break; case BodyType.Monster: { switch (animation) { default: action = Utility.Random(4, 3); break; } } break; case BodyType.Human: { if (!m.Mounted) { action = (int)animation; } else { switch (animation) { default: action = 26; break; case WeaponAnimation.Bash2H: case WeaponAnimation.Pierce2H: case WeaponAnimation.Slash2H: action = 29; break; case WeaponAnimation.ShootBow: action = 27; break; case WeaponAnimation.ShootXBow: action = 28; break; } } } break; default: return; } m.Animate(action, 7, 1, true, false, 0); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 8: case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) ) { m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if ( m_DamageLevel > WeaponDamageLevel.Vanq ) m_DamageLevel = WeaponDamageLevel.Ruin; } if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) ) { m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely ) m_AccuracyLevel = WeaponAccuracyLevel.Accurate; } if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) ) { m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible ) m_DurabilityLevel = WeaponDurabilityLevel.Durable; } if ( GetSaveFlag( flags, SaveFlag.Quality ) ) m_Quality = (WeaponQuality)reader.ReadInt(); else m_Quality = WeaponQuality.Regular; if ( GetSaveFlag( flags, SaveFlag.Hits ) ) m_Hits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.MaxHits ) ) m_MaxHits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Slayer ) ) m_Slayer = (SlayerName)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Poison ) ) m_Poison = Poison.Deserialize( reader ); if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) ) m_PoisonCharges = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) m_Crafter = reader.ReadMobile(); if ( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 6 || reader.ReadBool() ); if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadInt(); else m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadInt(); else m_DexReq = -1; if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadInt(); else m_IntReq = -1; if ( GetSaveFlag( flags, SaveFlag.MinDamage ) ) m_MinDamage = reader.ReadInt(); else m_MinDamage = -1; if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) ) m_MaxDamage = reader.ReadInt(); else m_MaxDamage = -1; if ( GetSaveFlag( flags, SaveFlag.HitSound ) ) m_HitSound = reader.ReadInt(); else m_HitSound = -1; if ( GetSaveFlag( flags, SaveFlag.MissSound ) ) m_MissSound = reader.ReadInt(); else m_MissSound = -1; if ( GetSaveFlag( flags, SaveFlag.Speed ) ) m_Speed = reader.ReadInt(); else m_Speed = -1; if ( GetSaveFlag( flags, SaveFlag.MaxRange ) ) m_MaxRange = reader.ReadInt(); else m_MaxRange = -1; if ( GetSaveFlag( flags, SaveFlag.Skill ) ) m_Skill = (SkillName)reader.ReadInt(); else m_Skill = (SkillName)(-1); if ( GetSaveFlag( flags, SaveFlag.Type ) ) m_Type = (WeaponType)reader.ReadInt(); else m_Type = (WeaponType)(-1); if ( GetSaveFlag( flags, SaveFlag.Animation ) ) m_Animation = (WeaponAnimation)reader.ReadInt(); else m_Animation = (WeaponAnimation)(-1); if ( GetSaveFlag( flags, SaveFlag.Resource ) ) m_Resource = (CraftResource)reader.ReadInt(); else m_Resource = CraftResource.Iron; if ( GetSaveFlag( flags, SaveFlag.xAttributes ) ) m_AosAttributes = new AosAttributes( this, reader ); else m_AosAttributes = new AosAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) ) m_AosWeaponAttributes = new AosWeaponAttributes( this, reader ); else m_AosWeaponAttributes = new AosWeaponAttributes( this ); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 ); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 ) m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon; if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile ) { m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon ); ((Mobile)Parent).AddSkillMod( m_MageMod ); } if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) m_PlayerConstructed = true; if( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses = new AosSkillBonuses( this, reader ); else m_AosSkillBonuses = new AosSkillBonuses(this); // mod to randomly add sockets and socketability features to weapons. These settings will yield // 2% drop rate of socketed/socketable items // 0.1% chance of 5 sockets // 0.5% of 4 sockets // 3% chance of 3 sockets // 15% chance of 2 sockets // 50% chance of 1 socket // the remainder will be 0 socket (31.4% in this case) // uncomment the next line to prevent artifacts from being socketed // if(ArtifactRarity == 0) XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0); if( GetSaveFlag( flags, SaveFlag.Slayer2 ) ) m_Slayer2 = (SlayerName)reader.ReadInt(); if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) ) m_AosElementDamages = new AosElementAttributes( this, reader ); else m_AosElementDamages = new AosElementAttributes( this ); break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if ( version == 0 ) m_MaxRange = 1; // default if ( version < 5 ) { m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes( this ); m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosElementDamages = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses(this); // mod to randomly add sockets and socketability features to weapons. These settings will yield // 2% drop rate of socketed/socketable items // 0.1% chance of 5 sockets // 0.5% of 4 sockets // 3% chance of 3 sockets // 15% chance of 2 sockets // 50% chance of 1 socket // the remainder will be 0 socket (31.4% in this case) // uncomment the next line to prevent artifacts from being socketed // if(ArtifactRarity == 0) XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0); } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize( reader ); m_PoisonCharges = reader.ReadInt(); if ( m_StrReq == OldStrengthReq ) m_StrReq = -1; if ( m_DexReq == OldDexterityReq ) m_DexReq = -1; if ( m_IntReq == OldIntelligenceReq ) m_IntReq = -1; if ( m_MinDamage == OldMinDamage ) m_MinDamage = -1; if ( m_MaxDamage == OldMaxDamage ) m_MaxDamage = -1; if ( m_HitSound == OldHitSound ) m_HitSound = -1; if ( m_MissSound == OldMissSound ) m_MissSound = -1; if ( m_Speed == OldSpeed ) m_Speed = -1; if ( m_MaxRange == OldMaxRange ) m_MaxRange = -1; if ( m_Skill == OldSkill ) m_Skill = (SkillName)(-1); if ( m_Type == OldType ) m_Type = (WeaponType)(-1); if ( m_Animation == OldAnimation ) m_Animation = (WeaponAnimation)(-1); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } break; } } if ( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo( (Mobile)Parent ); int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) ) { Mobile m = (Mobile)this.Parent; string modName = this.Serial.ToString(); if ( strBonus != 0 ) m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) ); if ( dexBonus != 0 ) m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) ); if ( intBonus != 0 ) m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) ); } if ( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); if ( m_Hits <= 0 && m_MaxHits <= 0 ) { m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); } if ( version < 6 ) m_PlayerConstructed = true; // we don't know, so, assume it's crafted }
public BaseWeapon( int itemID ) : base( itemID ) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes( this ); m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses(this); // mod to randomly add sockets and socketability features to weapons. These settings will yield // 2% drop rate of socketed/socketable items // 0.1% chance of 5 sockets // 0.5% of 4 sockets // 3% chance of 3 sockets // 15% chance of 2 sockets // 50% chance of 1 socket // the remainder will be 0 socket (31.4% in this case) // uncomment the next line to prevent artifacts from being socketed // if(ArtifactRarity == 0) XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0); m_AosElementDamages = new AosElementAttributes( this ); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { weaponAnimation = animator.GetComponent <WeaponAnimation>(); weaponAnimation.ReloadEnd(); }
public override void Deserialize( GenericReader reader ) { base.Deserialize(reader); int version = reader.ReadInt(); switch( version ) { case 11: case 10: case 9: case 8: { if( version <= 9 ) { reader.ReadMobile(); reader.ReadString(); reader.ReadMobile(); } goto case 7; } case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadInt(); if( GetSaveFlag(flags, SaveFlag.DamageLevel) ) { m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if( m_DamageLevel > WeaponDamageLevel.Vanq ) m_DamageLevel = WeaponDamageLevel.Ruin; } if( GetSaveFlag(flags, SaveFlag.AccuracyLevel) ) { m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if( m_AccuracyLevel > WeaponAccuracyLevel.Supremely ) m_AccuracyLevel = WeaponAccuracyLevel.Accurate; } if( GetSaveFlag(flags, SaveFlag.DurabilityLevel) ) { m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible ) m_DurabilityLevel = WeaponDurabilityLevel.Durable; } if( GetSaveFlag(flags, SaveFlag.Quality) ) m_Quality = (WeaponQuality)reader.ReadInt(); else m_Quality = WeaponQuality.Regular; if( GetSaveFlag(flags, SaveFlag.Hits) ) m_Hits = reader.ReadInt(); if( GetSaveFlag(flags, SaveFlag.MaxHits) ) m_MaxHits = reader.ReadInt(); if( GetSaveFlag(flags, SaveFlag.Slayer) ) m_Slayer = (SlayerName)reader.ReadInt(); if( GetSaveFlag(flags, SaveFlag.Poison) ) m_Poison = Poison.Deserialize(reader); if( GetSaveFlag(flags, SaveFlag.PoisonCharges) ) m_PoisonCharges = reader.ReadInt(); if( GetSaveFlag(flags, SaveFlag.Crafter) ) m_Crafter = reader.ReadMobile(); if( GetSaveFlag(flags, SaveFlag.Identified) ) { if( version <= 10 ) m_Identified = true; else m_Identified = reader.ReadBool(); } if( GetSaveFlag(flags, SaveFlag.StrReq) ) m_StrReq = reader.ReadInt(); else m_StrReq = -1; if( GetSaveFlag(flags, SaveFlag.DexReq) ) m_DexReq = reader.ReadInt(); else m_DexReq = -1; if( GetSaveFlag(flags, SaveFlag.IntReq) ) m_IntReq = reader.ReadInt(); else m_IntReq = -1; if( GetSaveFlag(flags, SaveFlag.MinDamage) ) m_MinDamage = reader.ReadInt(); else m_MinDamage = -1; if( GetSaveFlag(flags, SaveFlag.MaxDamage) ) m_MaxDamage = reader.ReadInt(); else m_MaxDamage = -1; if( GetSaveFlag(flags, SaveFlag.HitSound) ) m_HitSound = reader.ReadInt(); else m_HitSound = -1; if( GetSaveFlag(flags, SaveFlag.MissSound) ) m_MissSound = reader.ReadInt(); else m_MissSound = -1; if( GetSaveFlag(flags, SaveFlag.Speed) ) { if( version < 9 ) m_Speed = reader.ReadInt(); else m_Speed = reader.ReadFloat(); } else m_Speed = -1; if( GetSaveFlag(flags, SaveFlag.MaxRange) ) m_MaxRange = reader.ReadInt(); else m_MaxRange = -1; if( GetSaveFlag(flags, SaveFlag.Skill) ) m_Skill = (SkillName)reader.ReadInt(); else m_Skill = (SkillName)(-1); if( GetSaveFlag(flags, SaveFlag.Type) ) m_Type = (WeaponType)reader.ReadInt(); else m_Type = (WeaponType)(-1); if( GetSaveFlag(flags, SaveFlag.Animation) ) m_Animation = (WeaponAnimation)reader.ReadInt(); else m_Animation = (WeaponAnimation)(-1); if( GetSaveFlag(flags, SaveFlag.Resource) ) m_Resource = (CraftResource)reader.ReadInt(); else m_Resource = CraftResource.Iron; if( GetSaveFlag(flags, SaveFlag.xAttributes) ) m_AosAttributes = new AosAttributes(this, reader); else m_AosAttributes = new AosAttributes(this); if( GetSaveFlag(flags, SaveFlag.xWeaponAttributes) ) m_AosWeaponAttributes = new AosWeaponAttributes(this, reader); else m_AosWeaponAttributes = new AosWeaponAttributes(this); if( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod(m_SkillMod); } if( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 ) m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon; if( Core.SE && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile ) { m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon); ((Mobile)Parent).AddSkillMod(m_MageMod); } if( GetSaveFlag(flags, SaveFlag.PlayerConstructed) ) m_PlayerConstructed = true; if( GetSaveFlag(flags, SaveFlag.SkillBonuses) ) m_AosSkillBonuses = new AosSkillBonuses(this, reader); else m_AosSkillBonuses = new AosSkillBonuses(this); if( GetSaveFlag(flags, SaveFlag.Slayer2) ) m_Slayer2 = (SlayerName)reader.ReadInt(); break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if( version == 0 ) m_MaxRange = 1; // default if( version < 5 ) { m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes(this); m_AosWeaponAttributes = new AosWeaponAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize(reader); m_PoisonCharges = reader.ReadInt(); if( m_StrReq == OldStrengthReq ) m_StrReq = -1; if( m_DexReq == OldDexterityReq ) m_DexReq = -1; if( m_IntReq == OldIntelligenceReq ) m_IntReq = -1; if( m_MinDamage == OldMinDamage ) m_MinDamage = -1; if( m_MaxDamage == OldMaxDamage ) m_MaxDamage = -1; if( m_HitSound == OldHitSound ) m_HitSound = -1; if( m_MissSound == OldMissSound ) m_MissSound = -1; if( m_Speed == OldSpeed ) m_Speed = -1; if( m_MaxRange == OldMaxRange ) m_MaxRange = -1; if( m_Skill == OldSkill ) m_Skill = (SkillName)(-1); if( m_Type == OldType ) m_Type = (WeaponType)(-1); if( m_Animation == OldAnimation ) m_Animation = (WeaponAnimation)(-1); if( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod(m_SkillMod); } break; } } if( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo((Mobile)Parent); int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) ) { Mobile m = (Mobile)this.Parent; string modName = this.Serial.ToString(); if( strBonus != 0 ) m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero)); if( dexBonus != 0 ) m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero)); if( intBonus != 0 ) m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero)); } if( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); if( m_Hits <= 0 && m_MaxHits <= 0 ) { m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); } if( version < 6 ) m_PlayerConstructed = true; // we don't know, so, assume it's crafted }
private void UpdateWeapon() { // Do nothing if weapon not ready if (weaponAtlas == null || weaponAnims == null || weaponRects == null || weaponIndices == null) { return; } // Reset state if weapon not visible if (!ShowWeapon || WeaponType == WeaponTypes.None) { weaponState = WeaponStates.Idle; currentFrame = 0; } // Handle bow with no arrows if (!GameManager.Instance.WeaponManager.Sheathed && WeaponType == WeaponTypes.Bow && GameManager.Instance.PlayerEntity.Items.GetItem(Items.ItemGroups.Weapons, (int)Items.Weapons.Arrow) == null) { GameManager.Instance.WeaponManager.SheathWeapons(); DaggerfallUI.SetMidScreenText(UserInterfaceWindows.HardStrings.youHaveNoArrows); } // Store rect and anim int weaponAnimRecordIndex; if (WeaponType == WeaponTypes.Bow) { weaponAnimRecordIndex = 0; // Bow has only 1 animation } else { weaponAnimRecordIndex = (int)weaponState; } try { bool isImported = customTextures.TryGetValue(MaterialReader.MakeTextureKey(0, (byte)weaponState, (byte)currentFrame), out curCustomTexture); if (FlipHorizontal && (weaponState == WeaponStates.Idle || weaponState == WeaponStates.StrikeDown || weaponState == WeaponStates.StrikeUp)) { // Mirror weapon rect if (isImported) { curAnimRect = new Rect(0, 1, -1, 1); } else { Rect rect = weaponRects[weaponIndices[weaponAnimRecordIndex].startIndex + currentFrame]; curAnimRect = new Rect(rect.xMax, rect.yMin, -rect.width, rect.height); } } else { curAnimRect = isImported ? new Rect(0, 0, 1, 1) : weaponRects[weaponIndices[weaponAnimRecordIndex].startIndex + currentFrame]; } WeaponAnimation anim = weaponAnims[(int)weaponState]; // Get weapon dimensions int width = weaponIndices[weaponAnimRecordIndex].width; int height = weaponIndices[weaponAnimRecordIndex].height; // Get weapon scale weaponScaleX = (float)Screen.width / (float)nativeScreenWidth; weaponScaleY = (float)Screen.height / (float)nativeScreenHeight; // Adjust scale to be slightly larger when not using point filtering // This reduces the effect of filter shrink at edge of display if (dfUnity.MaterialReader.MainFilterMode != FilterMode.Point) { weaponScaleX *= 1.01f; weaponScaleY *= 1.01f; } // Source weapon images are designed to overlay a fixed 320x200 display. // Some weapons need to align with both top, bottom, and right of display. // This means they might be a little stretched on widescreen displays. switch (anim.Alignment) { case WeaponAlignment.Left: AlignLeft(anim, width, height); break; case WeaponAlignment.Center: AlignCenter(anim, width, height); break; case WeaponAlignment.Right: AlignRight(anim, width, height); break; } } catch (IndexOutOfRangeException) { DaggerfallUnity.LogMessage("Index out of range exception for weapon animation. Probably due to weapon breaking + being unequipped during animation."); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); reader.GetVersion(); TransmuteID = reader.ReadInt(); TransmuteHue = reader.ReadInt(); TransmuteAnimation = (WeaponAnimation) reader.ReadInt(); TransmuteName = reader.ReadString(); }
private void AlignRight(WeaponAnimation anim, int width, int height) { if (LeftHand && (weaponState == WeaponStates.Idle || weaponState == WeaponStates.StrikeDown || weaponState == WeaponStates.StrikeUp)) { // Flip alignment AlignLeft(anim, width, height); return; } weaponPosition = new Rect( Screen.width * (1f - anim.Offset) - width * weaponScaleX, Screen.height - height * weaponScaleY, width * weaponScaleX, height * weaponScaleY); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 9: case 8: case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) ) { m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if ( m_DamageLevel > WeaponDamageLevel.Vanq ) m_DamageLevel = WeaponDamageLevel.Ruin; } if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) ) { m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely ) m_AccuracyLevel = WeaponAccuracyLevel.Accurate; } if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) ) { m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible ) m_DurabilityLevel = WeaponDurabilityLevel.Durable; } if ( GetSaveFlag( flags, SaveFlag.Quality ) ) m_Quality = (WeaponQuality)reader.ReadInt(); else m_Quality = WeaponQuality.Regular; if ( GetSaveFlag( flags, SaveFlag.Hits ) ) m_Hits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.MaxHits ) ) m_MaxHits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Slayer ) ) m_Slayer = (SlayerName)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Poison ) ) m_Poison = Poison.Deserialize( reader ); if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) ) m_PoisonCharges = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) m_Crafter = reader.ReadMobile(); if ( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 6 || reader.ReadBool() ); if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadInt(); else m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadInt(); else m_DexReq = -1; if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadInt(); else m_IntReq = -1; if ( GetSaveFlag( flags, SaveFlag.MinDamage ) ) m_MinDamage = reader.ReadInt(); else m_MinDamage = -1; if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) ) m_MaxDamage = reader.ReadInt(); else m_MaxDamage = -1; if ( GetSaveFlag( flags, SaveFlag.HitSound ) ) m_HitSound = reader.ReadInt(); else m_HitSound = -1; if ( GetSaveFlag( flags, SaveFlag.MissSound ) ) m_MissSound = reader.ReadInt(); else m_MissSound = -1; if ( GetSaveFlag( flags, SaveFlag.Speed ) ) { if ( version < 9 ) m_Speed = reader.ReadInt(); else m_Speed = reader.ReadFloat(); } else m_Speed = -1; if ( GetSaveFlag( flags, SaveFlag.MaxRange ) ) m_MaxRange = reader.ReadInt(); else m_MaxRange = -1; if ( GetSaveFlag( flags, SaveFlag.Skill ) ) m_Skill = (SkillName)reader.ReadInt(); else m_Skill = (SkillName)(-1); if ( GetSaveFlag( flags, SaveFlag.Type ) ) m_Type = (WeaponType)reader.ReadInt(); else m_Type = (WeaponType)(-1); if ( GetSaveFlag( flags, SaveFlag.Animation ) ) m_Animation = (WeaponAnimation)reader.ReadInt(); else m_Animation = (WeaponAnimation)(-1); if ( GetSaveFlag( flags, SaveFlag.Resource ) ) m_Resource = (CraftResource)reader.ReadInt(); else m_Resource = CraftResource.Iron; if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 ); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) m_PlayerConstructed = true; if( GetSaveFlag( flags, SaveFlag.Slayer2 ) ) m_Slayer2 = (SlayerName)reader.ReadInt(); if( GetSaveFlag( flags, SaveFlag.EngravedText ) ) m_EngravedText = reader.ReadString(); break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if ( version == 0 ) m_MaxRange = 1; // default if ( version < 5 ) { m_Resource = CraftResource.Iron; } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize( reader ); m_PoisonCharges = reader.ReadInt(); if ( m_StrReq == OldStrengthReq ) m_StrReq = -1; if ( m_DexReq == OldDexterityReq ) m_DexReq = -1; if ( m_IntReq == OldIntelligenceReq ) m_IntReq = -1; if ( m_MinDamage == OldMinDamage ) m_MinDamage = -1; if ( m_MaxDamage == OldMaxDamage ) m_MaxDamage = -1; if ( m_HitSound == OldHitSound ) m_HitSound = -1; if ( m_MissSound == OldMissSound ) m_MissSound = -1; if ( m_Speed == OldSpeed ) m_Speed = -1; if ( m_MaxRange == OldMaxRange ) m_MaxRange = -1; if ( m_Skill == OldSkill ) m_Skill = (SkillName)(-1); if ( m_Type == OldType ) m_Type = (WeaponType)(-1); if ( m_Animation == OldAnimation ) m_Animation = (WeaponAnimation)(-1); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } break; } } if ( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); if ( m_Hits <= 0 && m_MaxHits <= 0 ) { m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); } if ( version < 6 ) m_PlayerConstructed = true; // we don't know, so, assume it's crafted }
private void AlignLeft(WeaponAnimation anim, int width, int height) { weaponPosition = new Rect( Screen.width * anim.Offset, Screen.height - height * weaponScaleY, width * weaponScaleX, height * weaponScaleY); }
private void AlignCenter(WeaponAnimation anim, int width, int height) { weaponPosition = new Rect( Screen.width / 2f - (width * weaponScaleX) / 2f, Screen.height - height * weaponScaleY, width * weaponScaleX, height * weaponScaleY); }
public static void SwingAnimation(Mobile mob) { if (mob == null || mob.Weapon == null || !(mob.Weapon is BaseWeapon)) { return; } int action; WeaponAnimation animation = ((BaseWeapon)mob.Weapon).Animation; switch (mob.Body.Type) { case BodyType.Sea: case BodyType.Animal: action = Utility.Random(5, 2); break; case BodyType.Monster: { switch (animation) { default: action = Utility.Random(4, 3); break; } break; } case BodyType.Human: { if (!mob.Mounted) { action = (int)animation; } else { switch (animation) { default: /* default case makes all these cases redundant * case WeaponAnimation.Wrestle: * case WeaponAnimation.Bash1H: * case WeaponAnimation.Pierce1H: * case WeaponAnimation.Slash1H: */ action = 26; break; case WeaponAnimation.Bash2H: case WeaponAnimation.Pierce2H: case WeaponAnimation.Slash2H: action = 29; break; case WeaponAnimation.ShootBow: action = 27; break; case WeaponAnimation.ShootXBow: action = 28; break; } } break; } default: return; } mob.Animate(action, 7, 1, true, false, 0); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 27: case 26: m_BetaNerf = reader.ReadBool(); goto case 25; case 25: m_Components = reader.ReadStrongItemList(); goto case 24; case 24: m_NewCrafting = reader.ReadBool(); m_QualityDefense = reader.ReadInt(); goto case 23; case 23: m_HasHalo = reader.ReadBool(); goto case 22; case 22: case 21: case 20: { m_QualityDamage = reader.ReadInt(); m_QualitySpeed = reader.ReadInt(); m_QualityAccuracy = reader.ReadInt(); goto case 19; } case 19: case 18: case 17: case 16: case 15: case 14: case 13: case 12: case 11: case 10: { m_CraftersOriginalName = reader.ReadString(); goto case 9; } case 9: { m_Engraved1 = reader.ReadString(); m_Engraved2 = reader.ReadString(); m_Engraved3 = reader.ReadString(); goto case 5; } case 8: case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) ) { m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if ( m_DamageLevel > WeaponDamageLevel.Vanq ) m_DamageLevel = WeaponDamageLevel.Ruin; } if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) ) { m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely ) m_AccuracyLevel = WeaponAccuracyLevel.Accurate; } if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) ) { m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible ) m_DurabilityLevel = WeaponDurabilityLevel.Durable; } if ( GetSaveFlag( flags, SaveFlag.Quality ) ) m_Quality = (WeaponQuality)reader.ReadInt(); else m_Quality = WeaponQuality.Regular; if ( GetSaveFlag( flags, SaveFlag.Hits ) ) m_Hits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.MaxHits ) ) m_MaxHits = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Slayer ) ) m_Slayer = (SlayerName)reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Poison ) ) m_Poison = Poison.Deserialize( reader ); if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) ) m_PoisonCharges = reader.ReadInt(); if ( GetSaveFlag( flags, SaveFlag.Crafter ) ) m_Crafter = reader.ReadMobile(); if ( GetSaveFlag( flags, SaveFlag.Identified ) ) m_Identified = ( version >= 6 || reader.ReadBool() ); if ( GetSaveFlag( flags, SaveFlag.StrReq ) ) m_StrReq = reader.ReadInt(); else m_StrReq = -1; if ( GetSaveFlag( flags, SaveFlag.DexReq ) ) m_DexReq = reader.ReadInt(); else m_DexReq = -1; if ( GetSaveFlag( flags, SaveFlag.IntReq ) ) m_IntReq = reader.ReadInt(); else m_IntReq = -1; if ( GetSaveFlag( flags, SaveFlag.MinDamage ) ) m_MinDamage = reader.ReadInt(); else m_MinDamage = -1; if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) ) m_MaxDamage = reader.ReadInt(); else m_MaxDamage = -1; if ( GetSaveFlag( flags, SaveFlag.HitSound ) ) m_HitSound = reader.ReadInt(); else m_HitSound = -1; if ( GetSaveFlag( flags, SaveFlag.MissSound ) ) m_MissSound = reader.ReadInt(); else m_MissSound = -1; if ( GetSaveFlag( flags, SaveFlag.Speed ) ) m_Speed = reader.ReadInt(); else m_Speed = -1; if ( GetSaveFlag( flags, SaveFlag.MaxRange ) ) m_MaxRange = reader.ReadInt(); else m_MaxRange = -1; if ( GetSaveFlag( flags, SaveFlag.Skill ) ) m_Skill = (SkillName)reader.ReadInt(); else m_Skill = (SkillName)(-1); if ( GetSaveFlag( flags, SaveFlag.Type ) ) m_Type = (WeaponType)reader.ReadInt(); else m_Type = (WeaponType)(-1); if ( GetSaveFlag( flags, SaveFlag.Animation ) ) m_Animation = (WeaponAnimation)reader.ReadInt(); else m_Animation = (WeaponAnimation)(-1); if ( GetSaveFlag( flags, SaveFlag.Resource ) ) m_Resource = (CraftResource)reader.ReadInt(); else m_Resource = CraftResource.Iron; if ( GetSaveFlag( flags, SaveFlag.xAttributes ) ) m_AosAttributes = new AosAttributes( this, reader ); else m_AosAttributes = new AosAttributes( this ); if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) ) m_AosWeaponAttributes = new AosWeaponAttributes( this, reader ); else m_AosWeaponAttributes = new AosWeaponAttributes( this ); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 ); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 ) m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon; if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile ) { m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon ); ((Mobile)Parent).AddSkillMod( m_MageMod ); } if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) m_PlayerConstructed = true; if( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses = new AosSkillBonuses( this, reader ); else m_AosSkillBonuses = new AosSkillBonuses( this ); if( GetSaveFlag( flags, SaveFlag.Slayer2 ) ) m_Slayer2 = (SlayerName)reader.ReadInt(); if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) ) m_AosElementDamages = new AosElementAttributes( this, reader ); else m_AosElementDamages = new AosElementAttributes( this ); break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if ( version == 0 ) m_MaxRange = 1; // default if ( version < 5 ) { m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes( this ); m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosElementDamages = new AosElementAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize( reader ); m_PoisonCharges = reader.ReadInt(); if ( m_StrReq == OldStrengthReq ) m_StrReq = -1; if ( m_DexReq == OldDexterityReq ) m_DexReq = -1; if ( m_IntReq == OldIntelligenceReq ) m_IntReq = -1; if ( m_MinDamage == OldMinDamage ) m_MinDamage = -1; if ( m_MaxDamage == OldMaxDamage ) m_MaxDamage = -1; if ( m_HitSound == OldHitSound ) m_HitSound = -1; if ( m_MissSound == OldMissSound ) m_MissSound = -1; if ( m_Speed == OldSpeed ) m_Speed = -1; if ( m_MaxRange == OldMaxRange ) m_MaxRange = -1; if ( m_Skill == OldSkill ) m_Skill = (SkillName)(-1); if ( m_Type == OldType ) m_Type = (WeaponType)(-1); if ( m_Animation == OldAnimation ) m_Animation = (WeaponAnimation)(-1); if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile ) { m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod( m_SkillMod ); } break; } } if ( Core.AOS && Parent is Mobile ) m_AosSkillBonuses.AddTo( (Mobile)Parent ); int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if ( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) ) { Mobile m = (Mobile)this.Parent; string modName = this.Serial.ToString(); if ( strBonus != 0 ) m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) ); if ( dexBonus != 0 ) m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) ); if ( intBonus != 0 ) m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) ); } if ( Parent is Mobile ) ((Mobile)Parent).CheckStatTimers(); if ( m_Hits <= 0 && m_MaxHits <= 0 ) { m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); } if( version < 15 && this is IBoneArmour ) this.Attributes.WeaponSpeed -= 4; if( version < 16 ) FixResource(); if( version < 17 ) { this.m_Speed = -1; this.m_MinDamage = -1; this.m_MaxDamage = -1; if( this.Hue == 2413 ) this.Resource = CraftResource.Copper; if( this.Hue == 2418 ) this.Resource = CraftResource.Bronze; } if( version < 18 ) this.DurabilityLevel = WeaponDurabilityLevel.Regular; if( version < 19 ) { if( this.HitPoints > 175 ) this.HitPoints = 175; if( this.MaxHitPoints > 175 ) this.MaxHitPoints = 175; } if( version < 20 ) FixBonuses(); if( version < 21 ) { if( this is IBoneArmour ) Hue = 0; else Hue = CraftResources.GetHue( this.Resource ); } if( version < 22 ) { Speed = -1; MinDamage = -1; MaxDamage = -1; } if ( version == 26 ) BetaNerf = false; }
public Weapon(String name, WeaponAnimation animation) { m_name = name; m_animation = animation; }
public BaseWeapon( int itemID ) : base(itemID) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); m_Components = new List<Item>(); m_AosAttributes = new AosAttributes( this ); m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_AosElementDamages = new AosElementAttributes( this ); if( this is BaseRanged || this is AzhuranBoomerang || this is DruidStaff || this is ProphetDiviningRod || this is ClericCrook || this is QuarterStaff || this is GnarledStaff || this is SpikedClub || this is Club || this is BlackStaff ) this.Resource = CraftResource.Oak; else { this.Resource = CraftResource.Copper; this.Hue = 2413; } if( this is IBoneArmour ) this.Hue = 0; }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 12: { #region Runic Reforging m_ReforgedPrefix = (ReforgedPrefix)reader.ReadInt(); m_ReforgedSuffix = (ReforgedSuffix)reader.ReadInt(); m_ItemPower = (ItemPower)reader.ReadInt(); m_BlockRepair = reader.ReadBool(); #endregion #region Stygian Abyss m_DImodded = reader.ReadBool(); m_SearingWeapon = reader.ReadBool(); goto case 11; } case 11: { m_TimesImbued = reader.ReadInt(); #endregion goto case 10; } case 10: { m_BlessedBy = reader.ReadMobile(); m_EngravedText = reader.ReadString(); m_Slayer3 = (TalismanSlayerName)reader.ReadInt(); SetFlag flags = (SetFlag)reader.ReadEncodedInt(); if (GetSaveFlag(flags, SetFlag.Attributes)) { m_SetAttributes = new AosAttributes(this, reader); } else { m_SetAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SetFlag.WeaponAttributes)) { m_SetSelfRepair = (new AosWeaponAttributes(this, reader)).SelfRepair; } if (GetSaveFlag(flags, SetFlag.SkillBonuses)) { m_SetSkillBonuses = new AosSkillBonuses(this, reader); } else { m_SetSkillBonuses = new AosSkillBonuses(this); } if (GetSaveFlag(flags, SetFlag.Hue)) { m_SetHue = reader.ReadInt(); } if (GetSaveFlag(flags, SetFlag.LastEquipped)) { m_LastEquipped = reader.ReadBool(); } if (GetSaveFlag(flags, SetFlag.SetEquipped)) { m_SetEquipped = reader.ReadBool(); } if (GetSaveFlag(flags, SetFlag.SetSelfRepair)) { m_SetSelfRepair = reader.ReadEncodedInt(); } goto case 5; } case 9: case 8: case 7: case 6: case 5: { SaveFlag flags = (SaveFlag)reader.ReadInt(); if (GetSaveFlag(flags, SaveFlag.DamageLevel)) { m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); if (m_DamageLevel > WeaponDamageLevel.Vanq) { m_DamageLevel = WeaponDamageLevel.Ruin; } } if (GetSaveFlag(flags, SaveFlag.AccuracyLevel)) { m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); if (m_AccuracyLevel > WeaponAccuracyLevel.Supremely) { m_AccuracyLevel = WeaponAccuracyLevel.Accurate; } } if (GetSaveFlag(flags, SaveFlag.DurabilityLevel)) { m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); if (m_DurabilityLevel > WeaponDurabilityLevel.Indestructible) { m_DurabilityLevel = WeaponDurabilityLevel.Durable; } } if (GetSaveFlag(flags, SaveFlag.Quality)) { m_Quality = (WeaponQuality)reader.ReadInt(); } else { m_Quality = WeaponQuality.Regular; } if (GetSaveFlag(flags, SaveFlag.Hits)) { m_Hits = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.MaxHits)) { m_MaxHits = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Slayer)) { m_Slayer = (SlayerName)reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Poison)) { m_Poison = Poison.Deserialize(reader); } if (GetSaveFlag(flags, SaveFlag.PoisonCharges)) { m_PoisonCharges = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { m_Crafter = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Identified)) { m_Identified = (version >= 6 || reader.ReadBool()); } if (GetSaveFlag(flags, SaveFlag.StrReq)) { m_StrReq = reader.ReadInt(); } else { m_StrReq = -1; } if (GetSaveFlag(flags, SaveFlag.DexReq)) { m_DexReq = reader.ReadInt(); } else { m_DexReq = -1; } if (GetSaveFlag(flags, SaveFlag.IntReq)) { m_IntReq = reader.ReadInt(); } else { m_IntReq = -1; } if (GetSaveFlag(flags, SaveFlag.MinDamage)) { m_MinDamage = reader.ReadInt(); } else { m_MinDamage = -1; } if (GetSaveFlag(flags, SaveFlag.MaxDamage)) { m_MaxDamage = reader.ReadInt(); } else { m_MaxDamage = -1; } if (GetSaveFlag(flags, SaveFlag.HitSound)) { m_HitSound = reader.ReadInt(); } else { m_HitSound = -1; } if (GetSaveFlag(flags, SaveFlag.MissSound)) { m_MissSound = reader.ReadInt(); } else { m_MissSound = -1; } if (GetSaveFlag(flags, SaveFlag.Speed)) { if (version < 9) { m_Speed = reader.ReadInt(); } else { m_Speed = reader.ReadFloat(); } } else { m_Speed = -1; } if (GetSaveFlag(flags, SaveFlag.MaxRange)) { m_MaxRange = reader.ReadInt(); } else { m_MaxRange = -1; } if (GetSaveFlag(flags, SaveFlag.Skill)) { m_Skill = (SkillName)reader.ReadInt(); } else { m_Skill = (SkillName)(-1); } if (GetSaveFlag(flags, SaveFlag.Type)) { m_Type = (WeaponType)reader.ReadInt(); } else { m_Type = (WeaponType)(-1); } if (GetSaveFlag(flags, SaveFlag.Animation)) { m_Animation = (WeaponAnimation)reader.ReadInt(); } else { m_Animation = (WeaponAnimation)(-1); } if (GetSaveFlag(flags, SaveFlag.Resource)) { m_Resource = (CraftResource)reader.ReadInt(); } else { m_Resource = CraftResource.Iron; } if (GetSaveFlag(flags, SaveFlag.xAttributes)) { m_AosAttributes = new AosAttributes(this, reader); } else { m_AosAttributes = new AosAttributes(this); } if (GetSaveFlag(flags, SaveFlag.xWeaponAttributes)) { m_AosWeaponAttributes = new AosWeaponAttributes(this, reader); } else { m_AosWeaponAttributes = new AosWeaponAttributes(this); } if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile) { m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod(m_SkillMod); } if (version < 7 && m_AosWeaponAttributes.MageWeapon != 0) { m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon; } if (Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile) { m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon); ((Mobile)Parent).AddSkillMod(m_MageMod); } if (GetSaveFlag(flags, SaveFlag.PlayerConstructed)) { m_PlayerConstructed = true; } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) { m_AosSkillBonuses = new AosSkillBonuses(this, reader); } else { m_AosSkillBonuses = new AosSkillBonuses(this); } if (GetSaveFlag(flags, SaveFlag.Slayer2)) { m_Slayer2 = (SlayerName)reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.ElementalDamages)) { m_AosElementDamages = new AosElementAttributes(this, reader); } else { m_AosElementDamages = new AosElementAttributes(this); } if (GetSaveFlag(flags, SaveFlag.EngravedText)) { m_EngravedText = reader.ReadString(); } #region Stygian Abyss if (version > 9 && GetSaveFlag(flags, SaveFlag.xAbsorptionAttributes)) { m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader); } else { m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); } #endregion break; } case 4: { m_Slayer = (SlayerName)reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if (version == 0) { m_MaxRange = 1; // default } if (version < 5) { m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes(this); m_AosWeaponAttributes = new AosWeaponAttributes(this); m_AosElementDamages = new AosElementAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); } m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName)reader.ReadInt(); m_Type = (WeaponType)reader.ReadInt(); m_Animation = (WeaponAnimation)reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel)reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt(); m_Quality = (WeaponQuality)reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize(reader); m_PoisonCharges = reader.ReadInt(); if (m_StrReq == OldStrengthReq) { m_StrReq = -1; } if (m_DexReq == OldDexterityReq) { m_DexReq = -1; } if (m_IntReq == OldIntelligenceReq) { m_IntReq = -1; } if (m_MinDamage == OldMinDamage) { m_MinDamage = -1; } if (m_MaxDamage == OldMaxDamage) { m_MaxDamage = -1; } if (m_HitSound == OldHitSound) { m_HitSound = -1; } if (m_MissSound == OldMissSound) { m_MissSound = -1; } if (m_Speed == OldSpeed) { m_Speed = -1; } if (m_MaxRange == OldMaxRange) { m_MaxRange = -1; } if (m_Skill == OldSkill) { m_Skill = (SkillName)(-1); } if (m_Type == OldType) { m_Type = (WeaponType)(-1); } if (m_Animation == OldAnimation) { m_Animation = (WeaponAnimation)(-1); } if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile) { m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5); ((Mobile)Parent).AddSkillMod(m_SkillMod); } break; } } #region Mondain's Legacy Sets if (m_SetAttributes == null) { m_SetAttributes = new AosAttributes(this); } if (m_SetSkillBonuses == null) { m_SetSkillBonuses = new AosSkillBonuses(this); } #endregion if (Core.AOS && Parent is Mobile) { m_AosSkillBonuses.AddTo((Mobile)Parent); } int strBonus = m_AosAttributes.BonusStr; int dexBonus = m_AosAttributes.BonusDex; int intBonus = m_AosAttributes.BonusInt; if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0)) { Mobile m = (Mobile)Parent; string modName = Serial.ToString(); if (strBonus != 0) { m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero)); } if (dexBonus != 0) { m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero)); } if (intBonus != 0) { m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero)); } } if (Parent is Mobile) { ((Mobile)Parent).CheckStatTimers(); } if (m_Hits <= 0 && m_MaxHits <= 0) { m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); } if (version < 6) { m_PlayerConstructed = true; // we don't know, so, assume it's crafted } }
public BaseWeapon(int itemID) : base(itemID) { Layer = (Layer) ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_DamageMin = -1; m_DamageMax = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName) (-1); m_Type = (WeaponType) (-1); m_Animation = (WeaponAnimation) (-1); m_DiceDamage = new[] {-1, -1, -1}; m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); m_Resource = CraftResource.Iron; }
public BaseWeapon( int itemID ) : base( itemID ) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits ); m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes( this ); m_AosWeaponAttributes = new AosWeaponAttributes( this ); m_AosSkillBonuses = new AosSkillBonuses( this ); m_AosElementDamages = new AosElementAttributes( this ); #region GeNova: Mondain's Legacy m_SetAttributes = new AosAttributes( this ); m_SetWeaponAttributes = new AosWeaponAttributes( this ); m_SetSkillBonuses = new AosSkillBonuses( this ); m_LastEquipped = false; #endregion }
public static void addNewWeaponTemplate(String name, Color color, WeaponAnimation tex, Dictionary<String, int> stats) { if (s_weaponTemplates == null) s_weaponTemplates = new Dictionary<string, Weapon>(); Weapon w = new Weapon(name, tex); w.m_color = color; w.m_stats = stats; w.m_swingData = new List<Dictionary<String,float>>(); s_weaponTemplates.Add(name, w); }
public BaseWeapon(int itemID) : base(itemID) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes(this); m_AosWeaponAttributes = new AosWeaponAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); m_AosElementDamages = new AosElementAttributes(this); #region SA m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this ); #endregion #region Mondain's Legacy Sets m_SetAttributes = new AosAttributes(this); m_SetSkillBonuses = new AosSkillBonuses(this); #endregion ItemValue = GearScore.GetItemValue( this ); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 11: { OriginalItemID = reader.ReadInt(); OriginalHue = reader.ReadInt(); OriginalAnimation = (WeaponAnimation)reader.ReadInt(); goto case 10; } case 10: { var flags2 = (SaveFlag2) reader.ReadInt(); if (GetSaveFlag(flags2, SaveFlag2.Aesthetic)) // Alan Mod { m_Aesthetic = true; } m_DiceDamage = new[] {-1, -1, -1}; if (GetSaveFlag(flags2, SaveFlag2.DiceDamage)) { m_DiceDamage[0] = reader.ReadEncodedInt(); m_DiceDamage[1] = reader.ReadEncodedInt(); m_DiceDamage[2] = reader.ReadEncodedInt(); } goto case 9; } case 9: case 8: case 7: case 6: case 5: { var flags = (SaveFlag) reader.ReadInt(); if (GetSaveFlag(flags, SaveFlag.DamageLevel)) { m_DamageLevel = (WeaponDamageLevel) reader.ReadInt(); if (m_DamageLevel > WeaponDamageLevel.Vanq) { m_DamageLevel = WeaponDamageLevel.Ruin; } } if (GetSaveFlag(flags, SaveFlag.AccuracyLevel)) { m_AccuracyLevel = (WeaponAccuracyLevel) reader.ReadInt(); if (m_AccuracyLevel > WeaponAccuracyLevel.Supremely) { m_AccuracyLevel = WeaponAccuracyLevel.Accurate; } } if (GetSaveFlag(flags, SaveFlag.DurabilityLevel)) { m_DurabilityLevel = (WeaponDurabilityLevel) reader.ReadInt(); if (m_DurabilityLevel > WeaponDurabilityLevel.Indestructible) { m_DurabilityLevel = WeaponDurabilityLevel.Durable; } } if (GetSaveFlag(flags, SaveFlag.Quality)) { m_Quality = (WeaponQuality) reader.ReadInt(); } else { m_Quality = WeaponQuality.Regular; } if (GetSaveFlag(flags, SaveFlag.Hits)) { m_Hits = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.MaxHits)) { m_MaxHits = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Slayer)) { m_Slayer = (SlayerName) reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Poison)) { m_Poison = Poison.Deserialize(reader); } if (GetSaveFlag(flags, SaveFlag.PoisonCharges)) { m_PoisonCharges = reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.Crafter)) { m_Crafter = reader.ReadMobile(); } if (GetSaveFlag(flags, SaveFlag.Identified)) { m_Identified = (version >= 6 || reader.ReadBool()); } if (GetSaveFlag(flags, SaveFlag.StrReq)) { m_StrReq = reader.ReadInt(); } else { m_StrReq = -1; } if (GetSaveFlag(flags, SaveFlag.DexReq)) { m_DexReq = reader.ReadInt(); } else { m_DexReq = -1; } if (GetSaveFlag(flags, SaveFlag.IntReq)) { m_IntReq = reader.ReadInt(); } else { m_IntReq = -1; } if (GetSaveFlag(flags, SaveFlag.MinDamage)) { m_DamageMin = reader.ReadInt(); } else { m_DamageMin = -1; } if (GetSaveFlag(flags, SaveFlag.MaxDamage)) { m_DamageMax = reader.ReadInt(); } else { m_DamageMax = -1; } if (GetSaveFlag(flags, SaveFlag.HitSound)) { m_HitSound = reader.ReadInt(); } else { m_HitSound = -1; } if (GetSaveFlag(flags, SaveFlag.MissSound)) { m_MissSound = reader.ReadInt(); } else { m_MissSound = -1; } if (GetSaveFlag(flags, SaveFlag.Speed)) { if (version < 9) { m_Speed = reader.ReadInt(); } else { m_Speed = reader.ReadFloat(); } } else { m_Speed = -1; } if (GetSaveFlag(flags, SaveFlag.MaxRange)) { m_MaxRange = reader.ReadInt(); } else { m_MaxRange = -1; } if (GetSaveFlag(flags, SaveFlag.Skill)) { m_Skill = (SkillName) reader.ReadInt(); } else { m_Skill = (SkillName) (-1); } if (GetSaveFlag(flags, SaveFlag.Type)) { m_Type = (WeaponType) reader.ReadInt(); } else { m_Type = (WeaponType) (-1); } if (GetSaveFlag(flags, SaveFlag.Animation)) { m_Animation = (WeaponAnimation) reader.ReadInt(); } else { m_Animation = (WeaponAnimation) (-1); } if (GetSaveFlag(flags, SaveFlag.Resource)) { m_Resource = (CraftResource) reader.ReadInt(); } else { m_Resource = CraftResource.Iron; } if (GetSaveFlag(flags, SaveFlag.xAttributes)) //obsolete { new AosAttributes(this, reader); } //else // m_AosAttributes = new AosAttributes( this ); if (GetSaveFlag(flags, SaveFlag.xWeaponAttributes)) //obsolete { new AosWeaponAttributes(this, reader); } //else // m_AosWeaponAttributes = new AosWeaponAttributes( this ); if (UseSkillMod && m_Identified && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile) { m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int) m_AccuracyLevel * 5); ((Mobile) Parent).AddSkillMod(m_SkillMod); } //if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 ) // m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon; if (GetSaveFlag(flags, SaveFlag.PlayerConstructed)) { m_PlayerConstructed = true; } if (GetSaveFlag(flags, SaveFlag.SkillBonuses)) //obsolete { new AosSkillBonuses(this, reader); } //else // m_AosSkillBonuses = new AosSkillBonuses( this ); if (GetSaveFlag(flags, SaveFlag.Slayer2)) { m_Slayer2 = (SlayerName) reader.ReadInt(); } if (GetSaveFlag(flags, SaveFlag.ElementalDamages)) //obsolete { new AosElementAttributes(this, reader); } //else // m_AosElementDamages = new AosElementAttributes( this ); if (GetSaveFlag(flags, SaveFlag.EngravedText)) { m_EngravedText = reader.ReadString(); } if (version < 10) { m_DiceDamage = new[] {-1, -1, -1}; } break; } case 4: { m_Slayer = (SlayerName) reader.ReadInt(); goto case 3; } case 3: { m_StrReq = reader.ReadInt(); m_DexReq = reader.ReadInt(); m_IntReq = reader.ReadInt(); goto case 2; } case 2: { m_Identified = reader.ReadBool(); goto case 1; } case 1: { m_MaxRange = reader.ReadInt(); goto case 0; } case 0: { if (version == 0) { m_MaxRange = 1; // default } if (version < 5) { //m_Resource = CraftResource.Iron; //m_AosAttributes = new AosAttributes( this ); //m_AosWeaponAttributes = new AosWeaponAttributes( this ); //m_AosElementDamages = new AosElementAttributes( this ); //m_AosSkillBonuses = new AosSkillBonuses( this ); } m_DamageMin = reader.ReadInt(); m_DamageMax = reader.ReadInt(); m_Speed = reader.ReadInt(); m_HitSound = reader.ReadInt(); m_MissSound = reader.ReadInt(); m_Skill = (SkillName) reader.ReadInt(); m_Type = (WeaponType) reader.ReadInt(); m_Animation = (WeaponAnimation) reader.ReadInt(); m_DamageLevel = (WeaponDamageLevel) reader.ReadInt(); m_AccuracyLevel = (WeaponAccuracyLevel) reader.ReadInt(); m_DurabilityLevel = (WeaponDurabilityLevel) reader.ReadInt(); m_Quality = (WeaponQuality) reader.ReadInt(); m_Crafter = reader.ReadMobile(); m_Poison = Poison.Deserialize(reader); m_PoisonCharges = reader.ReadInt(); if (m_StrReq == OldStrengthReq) { m_StrReq = -1; } if (m_DexReq == OldDexterityReq) { m_DexReq = -1; } if (m_IntReq == OldIntelligenceReq) { m_IntReq = -1; } if (m_DamageMin == NewMinDamage) { m_DamageMin = -1; } if (m_DamageMax == NewMaxDamage) { m_DamageMax = -1; } if (m_HitSound == OldHitSound) { m_HitSound = -1; } if (m_MissSound == OldMissSound) { m_MissSound = -1; } if (m_Speed == OldSpeed) { m_Speed = -1; } if (m_MaxRange == OldMaxRange) { m_MaxRange = -1; } if (m_Skill == OldSkill) { m_Skill = (SkillName) (-1); } if (m_Type == OldType) { m_Type = (WeaponType) (-1); } if (m_Animation == OldAnimation) { m_Animation = (WeaponAnimation) (-1); } if (UseSkillMod && m_Identified && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile) { m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int) m_AccuracyLevel * 5); ((Mobile) Parent).AddSkillMod(m_SkillMod); } break; } } if (Parent is Mobile) { ((Mobile) Parent).CheckStatTimers(); } if (m_Hits <= 0 && m_MaxHits <= 0) { m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); } if (version < 6) { m_PlayerConstructed = true; // we don't know, so, assume it's crafted } }
public override void Deserialize(GenericReader reader) { base.Deserialize( reader ); int version = reader.ReadInt(); m_GastroAnimation = WeaponAnimation.Slash1H; }
public BaseWeapon( int itemID ) : base(itemID) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes(this); m_AosWeaponAttributes = new AosWeaponAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. #region loadTextures spriteBatch = new SpriteBatch(GraphicsDevice); p_icon = Content.Load <Texture2D>("P_Icon"); bar_edge = Content.Load <Texture2D>("Bar_Edge"); bar_eglow = Content.Load <Texture2D>("Bar_EdgeGlow"); bar_mid = Content.Load <Texture2D>("Bar_Mid"); bar_font = Content.Load <SpriteFont>("BarFont"); bar_filt = Content.Load <Texture2D>("Bar_Filter"); ko_font = Content.Load <SpriteFont>("KOCountFont"); map_edge = Content.Load <Texture2D>("Map_Border"); map_officer = Content.Load <Texture2D>("Map_Officer"); #endregion setupDefaultAnimations(); Minimap.initialize(bb); mm = new Minimap(8000, 8000, 4000, 4000, 32, 32, 128, 96, 100, map_edge, map_officer); mm.setDisplay(true); Unit a = new Unit(10050, 10080, 0, "Player"); a.setTexture(p_icon, Color.Azure); a.setStats(250, 170, 100, 100, 100, 100, 100, 120, 1, 0, 4000); a.m_important = true; UnitController PLAYERCONTROLLER = new UnitController(a); mm.addWatchUnit(PLAYERCONTROLLER); BattleGroup bgA = new BattleGroup(PLAYERCONTROLLER, 1); WeaponAnimation whammer = WeaponAnimation.getAnimation("WEAPON-SPRITE-WARHAMMER"); Weapon.addNewWeaponTemplate("Warhammer", Color.LightGray, whammer, new Dictionary <string, int>()); Weapon.addSwingToWeapon("Warhammer", 18.0f, 0.8f, -1.2f, 0.6f, 10); Weapon.addSwingToWeapon("Warhammer", 18.0f, -1.2f, 1.0f, 0.7f, 14); Weapon.addSwingToWeapon("Warhammer", 24.0f, 0.0f, -0.0f, 0.95f, 18); Weapon w = Weapon.getWeaponFromTemplate("Warhammer"); w.m_unitHeld = PLAYERCONTROLLER; a.m_weapon = w; #region createUnits Random ran = new Random(); for (int i = 0; i < 5; i++) { Unit l = new Unit(ran.Next(600) - 300 * i + 10000, ran.Next(600) + 50 * i + 10000, 0, "Lieutenant"); l.setStats(120, 80, 80, 80, 80, 80, 80, 80, 2, 0, 4000); l.setTexture(p_icon, Color.Blue); UnitController UCL = new UnitController(l); mm.addWatchUnit(UCL); BattleGroup BGX = new BattleGroup(UCL, 1); Weapon lw = Weapon.getWeaponFromTemplate("Warhammer"); lw.m_unitHeld = UCL; l.m_weapon = lw; for (int j = 0; j < 100; j++) { Unit f = new Unit(ran.Next(600) - 300 * i + 10000, ran.Next(600) + 50 * i + 10000, 0, "Private"); f.setStats(80, 50, 60, 60, 60, 60, 60, 60, 1, 0, 4000); f.setTexture(p_icon, Color.LightBlue); UnitController UCF = new UnitController(f); BGX.addUnit(UCF); Weapon fw = Weapon.getWeaponFromTemplate("Warhammer"); fw.m_unitHeld = UCF; f.m_weapon = fw; } bb.addUnitGroup("FriendlyFodder:" + i, BGX); } for (int i = 0; i < 6; i++) { Unit l = new Unit(ran.Next(600) + 300 * i + 10000, ran.Next(600) + 50 * i + 10000, 3.0f, "Lieutenant"); l.setStats(120, 80, 80, 80, 80, 80, 80, 80, 2, 0, 4000); l.setTexture(p_icon, Color.Red); UnitController UCL = new UnitController(l); mm.addWatchUnit(UCL); BattleGroup BGX = new BattleGroup(UCL, 2); Weapon lw = Weapon.getWeaponFromTemplate("Warhammer"); lw.m_unitHeld = UCL; l.m_weapon = lw; for (int j = 0; j < 100; j++) { Unit f = new Unit(ran.Next(600) + 600 * i + 10000, ran.Next(600) + 50 * i + 10000, 3.0f, "Private"); f.setStats(80, 50, 60, 60, 60, 60, 60, 60, 1, 0, 4000); f.setTexture(p_icon, Color.LightPink); UnitController UCF = new UnitController(f); BGX.addUnit(UCF); Weapon fw = Weapon.getWeaponFromTemplate("Warhammer"); fw.m_unitHeld = UCF; f.m_weapon = fw; } bb.addUnitGroup("Fodder:" + i, BGX); } #endregion bb.addFaction("Player Army", 1); bb.addFaction("Enemy Army", 2); bb.addUnit(PLAYERCONTROLLER); barDisplayUnit = PLAYERCONTROLLER; bb.addUnitGroup("Player", bgA); bb.m_camera.setScreenSize(SCREEN_WIDTH, SCREEN_HEIGHT); bb.m_camera.setUnitFocus("Player"); m_inputHandler = new UnitInputHandler(PlayerIndex.One, bb.getUnitController(a)); }
public BaseWeapon(int itemID) : base(itemID) { Layer = (Layer)ItemData.Quality; m_Quality = WeaponQuality.Regular; m_StrReq = -1; m_DexReq = -1; m_IntReq = -1; m_MinDamage = -1; m_MaxDamage = -1; m_HitSound = -1; m_MissSound = -1; m_Speed = -1; m_MaxRange = -1; m_Skill = (SkillName)(-1); m_Type = (WeaponType)(-1); m_Animation = (WeaponAnimation)(-1); m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits); m_Resource = CraftResource.Iron; m_AosAttributes = new AosAttributes(this); m_AosWeaponAttributes = new AosWeaponAttributes(this); m_AosSkillBonuses = new AosSkillBonuses(this); m_AosElementDamages = new AosElementAttributes(this); #region Stygian Abyss m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this); #endregion #region Mondain's Legacy Sets m_SetAttributes = new AosAttributes(this); m_SetSkillBonuses = new AosSkillBonuses(this); #endregion m_AosSkillBonuses = new AosSkillBonuses(this); // Xml Spawner XmlSockets - SOF // mod to randomly add sockets and socketability features to armor. These settings will yield // 2% drop rate of socketed/socketable items // 0.1% chance of 5 sockets // 0.5% of 4 sockets // 3% chance of 3 sockets // 15% chance of 2 sockets // 50% chance of 1 socket // the remainder will be 0 socket (31.4% in this case) if(XmlSpawner.SocketsEnabled) XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0); }
private void UpdateWeapon() { // Do nothing if weapon not ready if (weaponAtlas == null || weaponAnims == null || weaponRects == null || weaponIndices == null) { return; } // Reset state if weapon not visible if (!ShowWeapon) { weaponState = WeaponStates.Idle; return; } // Store rect and anim if (LeftHand && (weaponState == WeaponStates.Idle || weaponState == WeaponStates.StrikeDown || weaponState == WeaponStates.StrikeUp)) { // Mirror weapon rect Rect rect = weaponRects[weaponIndices[(int)weaponState].startIndex + currentFrame]; curAnimRect = new Rect(rect.xMax, rect.yMin, -rect.width, rect.height); } else { curAnimRect = weaponRects[weaponIndices[(int)weaponState].startIndex + currentFrame]; } WeaponAnimation anim = weaponAnims[(int)weaponState]; // Get weapon dimensions int width = weaponIndices[(int)weaponState].width; int height = weaponIndices[(int)weaponState].height; // Get weapon scale weaponScaleX = (float)Screen.width / (float)nativeScreenWidth; weaponScaleY = (float)Screen.height / (float)nativeScreenHeight; // Adjust scale to be slightly larger when not using point filtering // This reduces the effect of filter shrink at edge of display if (dfUnity.MaterialReader.MainFilterMode != FilterMode.Point) { weaponScaleX *= 1.01f; weaponScaleY *= 1.01f; } // Source weapon images are designed to overlay a fixed 320x200 display. // Some weapons need to align with both top, bottom, and right of display. // This means they might be a little stretched on widescreen displays. switch (anim.Alignment) { case WeaponAlignment.Left: AlignLeft(anim, width, height); break; case WeaponAlignment.Center: AlignCenter(anim, width, height); break; case WeaponAlignment.Right: AlignRight(anim, width, height); break; } }