コード例 #1
1
    public override void OnHitWeapon(BaseWeapon weapon, BaseCharacter attacker, DamageInfo dmg)
    {
        //Test to see if the person who just shot us is closer than our current target (usually the sandcastle)
        if (GameHandler.IsPlayer(attacker))
        {
            if (Vector3.Distance(transform.position, attacker.transform.position) < Vector3.Distance(transform.position, currentIntent.targetPosition))
            {
                //If the attacker is close, switch to him as the target and attack him/her
                currentIntent = new AIIntent() { owner = this, target = attacker, intent = Intent.Attack, intentAssignTime = Time.fixedTime };
            }
        }

        base.OnHitWeapon(weapon, attacker, dmg);

        if (this.CurrentHealth <= 0)
        {
            if (GameHandler.IsPlayer(attacker))
            {
                (attacker as PlayerController).RewardForKill(150, this);
                GameHandler.instance.spawnHandler.OnCrabDeath();

                //GameObject g = ItemDrop[Random.Range(0, ItemDrop.Length)];

                float r = Random.RandomRange(0.0f, 1.0f);

                if (r < dropProbabilty)
                {
                    GameObject g = (GameObject)GameObject.Instantiate(ItemDrop[Random.Range(0, ItemDrop.Length)], transform.position, transform.rotation);
                    g.rigidbody.AddForce(Vector3.up * 5, ForceMode.Impulse);
                }
            }
        }
    }
コード例 #2
0
ファイル: CreateNewWeapon.cs プロジェクト: hang10z/3D-RPG
    public void CreateWeapon()
    {
        newWeapon = new BaseWeapon();

        //assign name to weapon
        //TODO: Make a random Weapon Name Array and Assign
        //newWeapon.TemName = "W" + Random.Range(1,101);
        newWeapon.ItemName = weaponNames[Random.Range(0, weaponNames.Length)];

        //create a weapon description
        //TODO: Make a random Description Array and assign
        newWeapon.ItemDescription = "This is a temp Description";

        //weapon id
        //TODO: Make Sure Random ID is never Assigned Twice
        newWeapon.ItemId = Random.Range(100, 199);

        //stats
        //TODO: The stat generation needs to be changed, need new logic: Stats need to grow in size as Level does; Magic Weapon increases Magic More than Strength.. ETC
        //This section needs to be throughly reworked for good weapon generation

        newWeapon.Strength = Random.Range(1, 5);
        newWeapon.Dexterity = Random.Range(1, 5);
        newWeapon.Evasion = Random.Range(1, 5);
        newWeapon.Hp = Random.Range(30, 100);
        newWeapon.Intellect = Random.Range(1, 5);

        //choose type of weapon
        ChooseWeaponType();

        //spell effect id
        //TODO: Remember to Implement Spelleffect ID, and make sure this code makes sense
        newWeapon.SpellEffectID = Random.Range(500, 599);
    }
コード例 #3
0
ファイル: CreateNewWeapon.cs プロジェクト: railgan/IdleGame
    public BaseWeapon CreateWeapon()
    {
        newWeapon =  new BaseWeapon();

        //assign name to the weapon
        newWeapon.ItemName = "W" + Random.Range (1,101);

        //create a weapon descriptuion
        newWeapon.ItemDescription = "This is a random new Weapon";

        //weapon id
        newWeapon.ItemID = Random.Range(1,101);

        //stats
        newWeapon.Stamina = Random.Range (1,20);
        newWeapon.Strength = Random.Range (1,20);
        newWeapon.Dexterity = Random.Range (1,20);
        newWeapon.Intellect = Random.Range (1,20);
        newWeapon.Health = Random.Range (1,20);
        newWeapon.Mana = Random.Range (1,20);
        newWeapon.SpellEffectID = Random.Range (1,20);

        //weaponType
        ChooseWeaponType();

        //spellEffectID
        newWeapon.SpellEffectID = Random.Range (1,20);

        return newWeapon;
    }
コード例 #4
0
 void OnGetHit(BaseWeapon weapon)
 {
     HealthPoints -= weapon.Strength;
     if (GotToDie())
     {
         Die();
     }
 }
コード例 #5
0
ファイル: CreateNewWeapon.cs プロジェクト: youngtuna/EkaRPG
 public void CreateWeapon()
 {
     newWeapon = new BaseWeapon();
     newWeapon.ItemName = weaponNames[Random.Range(0,3)] + " weapon.";
     newWeapon.ItemDescription = "Hieno ase.";
     newWeapon.ItemID = Random.Range(0,101);
     ChooseWeaponType();
 }
コード例 #6
0
    /*public void Teste(){
        weaponsList.Add(KatanaScript);
        weaponsList.Add(SwordScript);

        SelectWeapon(WEAPON_ID.BAMBU);
        Debug.Log(equippedWeapon.ToString());

        SelectWeapon(WEAPON_ID.SWORD);
        Debug.Log(equippedWeapon.ToString());

    }*/
    public void SelectWeapon(WEAPON_ID pID)
    {
        for(int i = 0; i < weaponsList.Count; i++){
            if(weaponsList[i].weaponID == pID){
                equippedWeapon = weaponsList[i];
            }
        }
    }
コード例 #7
0
ファイル: BaseWeapon.cs プロジェクト: RAWeber/Unity
 public BaseWeapon(BaseWeapon item)
     : base(item)
 {
     subType = item.subType;
     Stats = new WeaponStatCollection();
     Stats.AddStat<LinkableStat>(StatType.ATTACKPOWER, item.Stats.GetStat(StatType.ATTACKPOWER).BaseValue);
     Stats.AddStat<LinkableStat>(StatType.ATTACKSPEED, item.Stats.GetStat(StatType.ATTACKSPEED).BaseValue);
     Stats.AddStat<LinkableStat>(StatType.ATTACKRANGE, item.Stats.GetStat(StatType.ATTACKRANGE).BaseValue);
     hand = item.Hand;
 }
コード例 #8
0
	void Awake () {
		MakeSingleton();
		StartCoroutine (StartLocationServices());

		eatDrikCounterIsOn = false;
		survivorPlayCardPrefab = Resources.Load<SurvivorPlayCard>("Prefabs/SurvivorPlayCard");
		baseWeaponPrefab = Resources.Load<BaseWeapon>("Prefabs/BaseWeaponPrefab");

		//ResetAllBuildings();
	}
コード例 #9
0
 /**
 * This function will create a weapon
 *
 * @retrurn void
 */
 public void createWeapon()
 {
     newWeapon = new BaseWeapon();
     newWeapon.ItemName = "W_" + weaponNames[Random.Range(0, 5)];
     newWeapon.ItemDescription = "A new awsome weapon!";
     newWeapon.ItemID = Random.Range(1, 101);
     newWeapon.Strength = Random.Range(1, 11);
     newWeapon.Intelligence = Random.Range(1, 11);
     chooseWeaponType();
     newWeapon.SpellEffectID = Random.Range(1, 101);
 }
コード例 #10
0
ファイル: CreateNewWeapon.cs プロジェクト: katongoukakyuu/RPG
    public void CreateWeapon()
    {
        newWeapon = new BaseWeapon ();
        newWeapon.itemName = "W" + Random.Range (1, 101);
        newWeapon.itemDescription = "This is a new Weapon.";
        newWeapon.itemID = Random.Range (1, 101);

        newWeapon.stamina = Random.Range (1, 11);
        newWeapon.endurance = Random.Range (1, 11);
        newWeapon.strength = Random.Range (1, 11);
        newWeapon.intellect = Random.Range (1, 11);

        ChooseWeaponType ();
        newWeapon.spellEffectID = Random.Range (1, 101);
    }
コード例 #11
0
ファイル: CreateNewWeapon.cs プロジェクト: ChikyuKaze/BetaRPG
    public void createWeapon()
    {
        newWeapon = new BaseWeapon ();
        newWeapon.ItemName = "W" + Random.Range (1, 101);
        newWeapon.ItemDescription = "This is a rad weapon.";
        newWeapon.ItemID = Random.Range (1, 101);

        newWeapon.Health = Random.Range (1, 11);
        newWeapon.Attack = Random.Range (1, 11);
        newWeapon.Magic = Random.Range (1, 11);
        newWeapon.Defence = Random.Range (1, 11);
        newWeapon.Resistance = Random.Range (1, 11);
        newWeapon.HiddenStatLuck = Random.Range (1, 11);
        newWeapon.AwesomeStat = Random.Range (1, 11);
        newWeapon.Speed = Random.Range (1, 11);

        chooseWeaponType ();
    }
コード例 #12
0
ファイル: CreateItem.cs プロジェクト: railgan/IdleGame
 public BaseItem CreateAItem(int ItemSelection)
 {
     if (ItemSelection == 1) {
         anEquipment = newEquipment.CreateEquipment ();
         return anEquipment;
     } else if (ItemSelection == 2) {
         aWeapon = newWeapon.CreateWeapon ();
         return aWeapon;
     } else if (ItemSelection == 3) {
         aPotion = newPotion.CreatePotion ();
         return aPotion;
     } else if (ItemSelection == 4) {
         aScroll = newScroll.CreateScroll ();
         return aScroll;
     } else {
         anEquipment = newEquipment.CreateEquipment ();
         return anEquipment;
     }
 }
コード例 #13
0
ファイル: CreateWeapon.cs プロジェクト: brami007/The-Revered
    public void CreateWeapons()
    {
        newWeapon = new BaseWeapon ();

        //weapon name
        newWeapon.ItemName = "w" + Random.Range (1, 101);
        //description
        newWeapon.ItemDescription = "new weapon";
        //id
        newWeapon.ItemID = Random.Range(1,101);
        //stats
        newWeapon.Strength = Random.Range (1, 11);
        newWeapon.Resiliance = Random.Range (1, 11);
        newWeapon.Intellect = Random.Range (1, 11);
        newWeapon.Endurance = Random.Range (1, 11);
        //type
        ChooseWeaponType ();
        //spelleffect
        newWeapon.SpellEffectID = Random.Range (1, 101);
    }
コード例 #14
0
	public void CreateWeapon(){

		newWeapon = new BaseWeapon();

		//Assign name to the weapon
		newWeapon.ItemName = "W" + Random.Range(1,101);
		//Create wep desc
		newWeapon.ItemDescription = "This is a new weapon.";
		//Wep ID
		newWeapon.ItemID = Random.Range(1,101);
		//Stats
		newWeapon.Stamina = Random.Range(1,11);
		newWeapon.Endurance = Random.Range (1, 11);
		newWeapon.Intellect = Random.Range (1, 11);
		newWeapon.Strenght = Random.Range (1, 11);
		//Choose Type of wep
		ChooseWeaponType();
		//Spell effect ID
		newWeapon.SpellEffectID = Random.Range(1,101);
	}
コード例 #15
0
ファイル: CreateNewWeapon.cs プロジェクト: mixterj/unity
	// create array to actually have names - do this later
	// private string[] weaponNames = new string[4] {"Common", "Great", "Unique", "Rare"} 
	public void CreateWeapon() {

		newWeapon = new BaseWeapon();
		// assign name to weapon
		newWeapon.ItemName = "W" + Random.Range(1, 101);
		// create weapon description
		newWeapon.ItemDsecription = "This is a new weapon.";
		// stats
		newWeapon.Endurance = Random.Range(1, 11);
		newWeapon.Stamina = Random.Range(1, 11);
		newWeapon.Strength = Random.Range(1, 11);
		newWeapon.Intellect = Random.Range(1, 11);
		//weapon ID
		newWeapon.ItemID = Random.Range(1, 101);
		// choose type of weapon
		ChooseWeaponType();
		// spell effect ID
		newWeapon.SpellEffectID = Random.Range(1, 101);

	}
コード例 #16
0
 /*
 //TODO something for later when the basics are polished
 public void Spell(int slot = 1)
 {
     Debug.Log("Spell" + slot);
 }
 */
 public void TakeDamage(BaseWeapon damageSource)
 {
     float damage = 0;
     if (resist.Contains(damageSource.damageType))
     {
         damage = damageSource.damage * 0.5f;
         damage = Mathf.RoundToInt(damage);
     }
     else if (vunerable.Contains(damageSource.damageType))
     {
         damage = damageSource.damage * 2f;
     }
     else
     {
         damage = damageSource.damage;
     }
     ChangeHealth((int)damage);
     if (GetComponent<CanvasDamagePopUp>())
     {
         GetComponent<CanvasDamagePopUp>().SpawnDamagePopUp((int)damage);
     }
 }
コード例 #17
0
ファイル: CreateNewWeapon.cs プロジェクト: thekrakenisme/RPG
 public void CreateWeapon()
 {
     newWeapon = new BaseWeapon();
     //assign a name to the weapon
     newWeapon.ItemName = itemNames[Random.Range(0,4)] + " weapon";
     //create a weapon description
     newWeapon.ItemDescription = itemDescription[Random.Range(0,itemDescription.Length)];
     //weapon ID
     newWeapon.ItemID = Random.Range(1,101);
     //stats
     newWeapon.Strength = Random.Range(1,10);
     newWeapon.Stamina = Random.Range(1,10);
     newWeapon.Dexterity = Random.Range(1,10);
     newWeapon.Occult = Random.Range(1,10);
     newWeapon.Intellect = Random.Range(1,10);
     newWeapon.Wisdom = Random.Range(1,10);
     newWeapon.Luck = Random.Range(1,10);
     //choose type of weapon
     ChooseWeaponType();
     //spell effect ID
     newWeapon.SpellEffectID = Random.Range(1,101);
 }
コード例 #18
0
    public override void OnHitWeapon(BaseWeapon weapon, BaseCharacter attacker, DamageInfo dmg)
    {
        //Test to see if the person who just shot us is closer than our current target (usually the sandcastle)
        if (GameHandler.IsPlayer(attacker))
        {
            hitCount++;
            lastHitTime = Time.time;

            if (hitCount > 5)
            {
                GameObject g = new GameObject("AITarget");

                g.transform.position = new Vector3(gameObject.transform.position.x + Random.Range(-20, 20), 0, gameObject.transform.position.z + Random.Range(-20, 20));

                AINullTarget target = g.AddComponent<AINullTarget>();

                currentIntent = new AIIntent() { intent = Intent.Flee, owner = this, intentAssignTime = Time.fixedTime, target = target };
            }

            /*if (attacker != currentIntent.target)
            {
                if (Vector3.Distance(transform.position, attacker.transform.position) < Vector3.Distance(transform.position, currentIntent.targetPosition))
                {
                    //If the attacker is close, switch to him as the target and attack him/her
                    currentIntent = new AIIntent() { owner = this, target = attacker, intent = Intent.Attack, intentAssignTime = Time.fixedTime };
                }
            }*/
        }

        base.OnHitWeapon(weapon, attacker, dmg);

        if (this.CurrentHealth <= 0)
        {
            if (GameHandler.IsPlayer(attacker))
            {
                (attacker as PlayerController).RewardForKill(600, this);
            }
        }
    }
コード例 #19
0
/*****************************CreateWeapon***********************************
 * In:
 * Out:
 * Purpose: 
 * **************************************************************************/
    public void CreateWeapon()
    {
        newWeapon = new BaseWeapon();

        //asign weapon name
        newWeapon.ItemName = "W" + Random.Range(1, 101);
        //create a description
        newWeapon.ItemDescription = "This is a weapon";
        //weapon id
        newWeapon.ItemID = Random.Range(1, 101);
        //stats
        newWeapon.Strength = Random.Range(1, 6);
        newWeapon.Constitution = Random.Range(1, 6);
        newWeapon.Dexterity = Random.Range(1, 6);
        newWeapon.Intellegence = Random.Range(1, 6);
        newWeapon.Wisdom = Random.Range(1, 6);
        newWeapon.Charisma = Random.Range(1, 6);
        //choose type of weapon
        ChooseWeaponType();
        //Damage
        newWeapon.DamageValue = Random.Range(1, 12);
        //spell effect ID
    }
コード例 #20
0
    public void CreateWeapon()
    {
        newWeapon = new BaseWeapon ();

        //assign Base Item
        newWeapon.ItemName = "W" + Random.Range (1, 101);
        newWeapon.ItemDescription = "Some random shitty human weapon.";
        newWeapon.ItemID = Random.Range (1, 101);

        //assign Base stat
        newWeapon.Size=Random.Range(1,101);
        newWeapon.Durability=Random.Range(1,101);
        newWeapon.Itemlevel=Random.Range(1,101);
        newWeapon.Itemlevelreq=Random.Range(1,101);

        newWeapon.SpellEffectID=Random.Range (1, 101);
        newWeapon.Dmg_min=Random.Range(1, 10);
        newWeapon.Dmg_max = newWeapon.Dmg_min + Random.Range (1, 3);
        newWeapon.Frequence= newWeapon.Itemlevel*2/(newWeapon.Dmg_min + newWeapon.Dmg_max);

        //WeaponType
        ChooseWeaponType ();
    }
コード例 #21
0
    //INGAMEINFO SECTION END
    //WEAPON CHANGE SECTION
    //Change weapon in inventory
    public void ChangePrefab(BaseWeapon newWeapon,WeaponBackUp weaponAddInfo)
    {
        for(int i=0;i<prefabWeapon.Length;i++){
            if(prefabWeapon[i].slotType==newWeapon.slotType){
                DropWeapon(prefabWeapon[i],weaponInfo[i]);
                prefabWeapon[i]=newWeapon;
                weaponInfo[i]=new WeaponBackUp(prefabWeapon[i].clipSize, prefabWeapon[i].ammoType);
                _ChangeWeapon(i);
                return;
            }
        }
        BaseWeapon[] oldprefabWeapon = prefabWeapon;
        WeaponBackUp[] oldweaponInfo = weaponInfo;
        prefabWeapon = new BaseWeapon[oldprefabWeapon.Length+1];
        weaponInfo = new WeaponBackUp[prefabWeapon.Length];
        for(int i=0;i<oldprefabWeapon.Length;i++){
            prefabWeapon[i]= oldprefabWeapon[i];
            weaponInfo[i]=new WeaponBackUp(oldweaponInfo[i]);

        }
        prefabWeapon[prefabWeapon.Length-1] = newWeapon;
        weaponInfo[prefabWeapon.Length-1]=weaponAddInfo;;
        return;
    }
コード例 #22
0
 //implementation of dropping weapon on ground after picking another one
 void DropWeapon(BaseWeapon oldWeapon,WeaponBackUp weaponinfo)
 {
     GameObject droppedWeapon =PhotonNetwork.Instantiate(oldWeapon.pickupPrefabPrefab.name,transform.position,transform.rotation,0) as GameObject;
     WeaponPicker picker = droppedWeapon.GetComponent<WeaponPicker>();
     picker.SetNewData (weaponinfo);
     //picker.info =weaponinfo;
 }
コード例 #23
0
ファイル: EnchantSpell .cs プロジェクト: ygtkms/ServUO
 public EnchantSpell(Mobile caster, Item scroll, BaseWeapon weapon, AosWeaponAttribute attribute) : base(caster, scroll, m_Info)
 {
     Weapon    = weapon;
     Attribute = attribute;
 }
コード例 #24
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!this.CheckMana(attacker, true))
            {
                return;
            }

            ArrayList list = new ArrayList();

            defender.PlaySound(1471);
            defender.BoltEffect(0);
            attacker.SendMessage("The Lighting Arrow strikes a target");

            foreach (Mobile m in defender.GetMobilesInRange(1))
            {
                list.Add(m);
            }

            ArrayList targets = new ArrayList();

            for (int i = 0; i < list.Count; ++i)
            {
                Mobile m = (Mobile)list[i];

                if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange))
                    {
                        continue;
                    }

                    if (attacker.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }
            }

            if (targets.Count > 0)
            {
                double damageBonus = 1.0 + Math.Pow(1, 2) / 100;

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = (Mobile)targets[i];

                    attacker.SendMessage("The Lighting Arrow strikes around a target");
                    m.PlaySound(1471);
                    m.BoltEffect(0);
                    weapon.OnHit(attacker, m, damageBonus);
                }
            }
        }
コード例 #25
0
	public BaseWeapon GenerateWeapon() {
		weapon = new BaseWeapon ();
		weapon.WeaponType = EnumeratorHelpers.GetRandomEnum<BaseWeapon.WeaponTypes> ();
		return weapon;
	}
コード例 #26
0
 public override float GetRange()
 {
     return(BaseWeapon.GetRange() + RangeModifier);
 }
コード例 #27
0
        public virtual void EquipSpecialty()
        {
            if (AbilityProfile != null && AbilityProfile.HasAbility(SpecialAbility.Heal))
            {
                PackItem(new Bandage(Utility.RandomMinMax(10, 25)));
            }

            SetWearable(new ThighBoots());
            SetWearable(new BodySash(), Utility.RandomSlimeHue());

            switch (_Specialty)
            {
            case SkillName.Chivalry:
                SetWearable(RandomSwordWeapon());
                PaladinEquip();
                break;

            case SkillName.Swords:
                SetWearable(RandomSwordWeapon());
                StandardMeleeEquip();
                break;

            case SkillName.Fencing:
                SetWearable(RandomFencingWeapon());
                StandardMeleeEquip();
                break;

            case SkillName.Macing:
                SetWearable(RandomMaceWeapon());
                StandardMeleeEquip();
                break;

            case SkillName.Archery:
                SetWearable(RandomArhceryWeapon());
                StandardMeleeEquip();
                break;

            case SkillName.Magery:
                SetWearable(RandomMageWeapon());
                StandardMageEquip();
                break;

            case SkillName.Mysticism:
                SetWearable(RandomMageWeapon());
                StandardMageEquip();
                break;

            case SkillName.Spellweaving:
                SetWearable(RandomMageWeapon());
                StandardMageEquip();
                break;

            case SkillName.Necromancy:
                SetWearable(RandomMageWeapon());
                StandardMageEquip();
                break;

            case SkillName.Bushido:
                BaseWeapon w = RandomSamuraiWeapon() as BaseWeapon;
                SetWearable(w);

                SetWearable(new LeatherSuneate());
                SetWearable(new LeatherJingasa());
                SetWearable(new LeatherDo());
                SetWearable(new LeatherHiroSode());
                SetWearable(new SamuraiTabi(Utility.RandomNondyedHue()));

                if (_Sampire)
                {
                    w.WeaponAttributes.HitLeechHits = 100;
                }

                SetSkill(SkillName.Parry, 120);
                break;

            case SkillName.Ninjitsu:
                SetWearable(RandomNinjaWeapon());

                LeatherNinjaBelt belt = new LeatherNinjaBelt();
                belt.UsesRemaining = 20;
                belt.Poison        = Poison.Greater;
                belt.PoisonCharges = 20;
                SetWearable(belt);

                for (int i = 0; i < 2; i++)
                {
                    Fukiya f = new Fukiya();
                    f.UsesRemaining = 10;
                    f.Poison        = Poison.Greater;
                    f.PoisonCharges = 10;
                    f.Movable       = false;
                    PackItem(f);
                }

                SetWearable(new NinjaTabi());
                SetWearable(new LeatherNinjaJacket());
                SetWearable(new LeatherNinjaHood());
                SetWearable(new LeatherNinjaPants());
                SetWearable(new LeatherNinjaMitts());

                break;

            case SkillName.Poisoning:
                BaseWeapon wep = RandomAssassinWeapon() as BaseWeapon;
                wep.Poison        = Poison.Lethal;
                wep.PoisonCharges = 100;
                SetWearable(wep);

                SetWearable(new LeatherChest());
                SetWearable(new LeatherLegs());
                SetWearable(new LeatherGloves());
                SetWearable(new LeatherGorget());
                break;
            }
        }
コード例 #28
0
 public static void ApplyAttributesTo(BaseWeapon weapon, int attributeCount, int min, int max)
 {
     ApplyAttributesTo(weapon, false, 0, attributeCount, min, max);
 }
コード例 #29
0
 public override float GetTimeBetweenAttacks()
 {
     return(BaseWeapon.GetTimeBetweenAttacks() + AttackSpeedModifier);
 }
コード例 #30
0
ファイル: BaseShield.cs プロジェクト: tateima/PathOfUO
        public override int OnHit(BaseWeapon weapon, int damage)
        {
            if (Core.AOS)
            {
                if (ArmorAttributes.SelfRepair > Utility.Random(10))
                {
                    HitPoints += 2;
                }
                else
                {
                    var halfArmor = ArmorRating / 2.0;
                    var absorbed  = (int)(halfArmor + halfArmor * Utility.RandomDouble());

                    if (absorbed < 2)
                    {
                        absorbed = 2;
                    }

                    int wear;

                    if (weapon.Type == WeaponType.Bashing)
                    {
                        wear = absorbed / 2;
                    }
                    else
                    {
                        wear = Utility.Random(2);
                    }

                    if (wear > 0 && MaxHitPoints > 0)
                    {
                        if (HitPoints >= wear)
                        {
                            HitPoints -= wear;
                            wear       = 0;
                        }
                        else
                        {
                            wear     -= HitPoints;
                            HitPoints = 0;
                        }

                        if (wear > 0)
                        {
                            if (MaxHitPoints > wear)
                            {
                                MaxHitPoints -= wear;

                                if (Parent is Mobile mobile)
                                {
                                    mobile.LocalOverheadMessage(
                                        MessageType.Regular,
                                        0x3B2,
                                        1061121
                                        ); // Your equipment is severely damaged.
                                }
                            }
                            else
                            {
                                Delete();
                            }
                        }
                    }
                }

                return(0);
            }

            if (!(Parent is Mobile owner))
            {
                return(damage);
            }

            var ar     = ArmorRating;
            var chance = (owner.Skills.Parry.Value - ar * 2.0) / 100.0;

            if (chance < 0.01)
            {
                chance = 0.01;
            }

            /*
             * FORMULA: Displayed AR = ((Parrying Skill * Base AR of Shield) � 200) + 1
             *
             * FORMULA: % Chance of Blocking = parry skill - (shieldAR * 2)
             *
             * FORMULA: Melee Damage Absorbed = (AR of Shield) / 2 | Archery Damage Absorbed = AR of Shield
             */
            if (owner.CheckSkill(SkillName.Parry, chance))
            {
                damage -= Math.Min(damage, weapon.Skill == SkillName.Archery ? (int)ar : (int)(ar / 2.0));

                owner.FixedEffect(0x37B9, 10, 16);

                if (Utility.Random(100) < 25) // 25% chance to lower durability
                {
                    var wear = Utility.Random(2);

                    if (wear > 0 && MaxHitPoints > 0)
                    {
                        if (HitPoints >= wear)
                        {
                            HitPoints -= wear;
                            wear       = 0;
                        }
                        else
                        {
                            wear     -= HitPoints;
                            HitPoints = 0;
                        }

                        if (wear > 0)
                        {
                            if (MaxHitPoints > wear)
                            {
                                MaxHitPoints -= wear;

                                ((Mobile)Parent).LocalOverheadMessage(
                                    MessageType.Regular,
                                    0x3B2,
                                    1061121
                                    ); // Your equipment is severely damaged.
                            }
                            else
                            {
                                Delete();
                            }
                        }
                    }
                }
            }

            return(damage);
        }
コード例 #31
0
        public override int OnHit(BaseWeapon weapon, int damage)
        {
            Mobile owner = this.Parent as Mobile;

            if (owner == null)
            {
                return(damage);
            }

            double ar     = this.ArmorRating;
            double chance = (owner.Skills[SkillName.Parry].Value - (ar * 2.0)) / 100.0;

            if (chance < 0.01)
            {
                chance = 0.01;
            }

            /*
             * FORMULA: Displayed AR = ((Parrying Skill * Base AR of Shield) ÷ 200) + 1
             *
             * FORMULA: % Chance of Blocking = parry skill - (shieldAR * 2)
             *
             * FORMULA: Melee Damage Absorbed = (AR of Shield) / 2 | Archery Damage Absorbed = AR of Shield
             */
            if (owner.CheckSkill(SkillName.Parry, chance))
            {
                if (weapon.Skill == SkillName.Archery)
                {
                    damage -= (int)ar;
                }
                else
                {
                    damage -= (int)(ar / 2.0);
                }

                if (damage < 0)
                {
                    damage = 0;
                }

                owner.FixedEffect(0x37B9, 10, 16);

                if (Utility.Random(3) == 0)
                {
                    int wear = Utility.Random(2);

                    if (wear > 0 && MaxHitPoints > 0)
                    {
                        if (HitPoints >= wear)
                        {
                            HitPoints -= wear;
                            wear       = 0;
                        }
                        else
                        {
                            wear     -= HitPoints;
                            HitPoints = 0;
                        }

                        if (wear > 0)
                        {
                            if (MaxHitPoints > wear)
                            {
                                MaxHitPoints -= wear;

                                if (Parent is Mobile)
                                {
                                    ((Mobile)Parent).LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061121);                                       // Your equipment is severely damaged.
                                }
                            }
                            else
                            {
                                Delete();
                            }
                        }
                    }
                }
            }

            return(damage);
        }
コード例 #32
0
ファイル: Mage.cs プロジェクト: slawdis/uoodyssey-scripts
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseMagicStaff && from.Backpack != null)
                {
                    BaseMagicStaff ba   = targeted as BaseMagicStaff;
                    BaseWeapon     bw   = targeted as BaseWeapon;
                    Container      pack = from.Backpack;

                    int toConsume   = 0;
                    int spellCircle = 0;
                    int myCharges   = 0;

                    if (bw.IntRequirement == 10)
                    {
                        spellCircle = 1; myCharges = 30;
                    }
                    else if (bw.IntRequirement == 15)
                    {
                        spellCircle = 2; myCharges = 23;
                    }
                    else if (bw.IntRequirement == 20)
                    {
                        spellCircle = 3; myCharges = 18;
                    }
                    else if (bw.IntRequirement == 25)
                    {
                        spellCircle = 4; myCharges = 15;
                    }
                    else if (bw.IntRequirement == 30)
                    {
                        spellCircle = 5; myCharges = 12;
                    }
                    else if (bw.IntRequirement == 35)
                    {
                        spellCircle = 6; myCharges = 9;
                    }
                    else if (bw.IntRequirement == 40)
                    {
                        spellCircle = 7; myCharges = 6;
                    }
                    else if (bw.IntRequirement == 45)
                    {
                        spellCircle = 8; myCharges = 3;
                    }

                    if (bw.IntRequirement < 1)
                    {
                        m_Mage.SayTo(from, "That does not need my services.");
                    }
                    else if (ba.Charges <= myCharges)
                    {
                        toConsume = spellCircle * 100;

                        if (BeggingPose(from) > 0)                           // LET US SEE IF THEY ARE BEGGING
                        {
                            toConsume = toConsume - (int)((from.Skills[SkillName.Begging].Value * 0.005) * toConsume);
                        }
                    }
                    else
                    {
                        m_Mage.SayTo(from, "That wand has too many charges already.");
                    }

                    if (toConsume == 0)
                    {
                        return;
                    }

                    if (pack.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        if (BeggingPose(from) > 0)
                        {
                            Titles.AwardKarma(from, -BeggingKarma(from), true);
                        }                                                                                                               // DO ANY KARMA LOSS
                        m_Mage.SayTo(from, "Your wand is charged.");
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x5C1);
                        ba.Charges = ba.Charges + 5;
                    }
                    else
                    {
                        m_Mage.SayTo(from, "It would cost you {0} gold to have that charged.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                else
                {
                    m_Mage.SayTo(from, "That does not need my services.");
                }
            }
コード例 #33
0
ファイル: Repair.cs プロジェクト: mythos8709/ServUO
            protected override void OnTarget(Mobile from, object targeted)
            {
                bool usingDeed = (m_Deed != null) || (m_Addon != null);
                bool toDelete  = false;
                int  number;

                double value = 0;

                if (m_Deed != null)
                {
                    value = m_Deed.SkillLevel;
                }
                else if (m_Addon != null)
                {
                    RepairBenchDefinition tool = m_Addon.Tools.Find(x => x.System == m_CraftSystem);

                    if (tool.Charges == 0)
                    {
                        from.SendLocalizedMessage(1019073);// This item is out of charges.
                        m_Addon.Using = false;
                        return;
                    }

                    value = tool.SkillValue;
                }
                else
                {
                    value = from.Skills[m_CraftSystem.MainSkill].Base;
                }

                if (m_CraftSystem is DefTinkering && targeted is IRepairableMobile)
                {
                    if (TryRepairMobile(from, (IRepairableMobile)targeted, usingDeed, out toDelete))
                    {
                        number = 1044279; // You repair the item.

                        m_CraftSystem.OnRepair(from, m_Tool, m_Deed, m_Addon, (IRepairableMobile)targeted);
                    }
                    else
                    {
                        number = 500426; // You can't repair that.
                    }
                }
                else if (targeted is Item)
                {
                    if (from.InRange(((Item)targeted).GetWorldLocation(), 2))
                    {
                        if (!CheckDeed(from))
                        {
                            if (m_Addon != null)
                            {
                                m_Addon.Using = false;
                            }

                            return;
                        }

                        if (!AllowsRepair(targeted, m_CraftSystem))
                        {
                            from.SendLocalizedMessage(500426); // You can't repair that.

                            if (m_Addon != null)
                            {
                                m_Addon.Using = false;
                            }

                            return;
                        }

                        if (m_CraftSystem.CanCraft(from, m_Tool, targeted.GetType()) == 1044267)
                        {
                            number = 1044282; // You must be near a forge and and anvil to repair items. * Yes, there are two and's *
                        }
                        else if (!usingDeed && m_CraftSystem is DefTinkering && targeted is BrokenAutomatonHead)
                        {
                            if (((BrokenAutomatonHead)targeted).TryRepair(from))
                            {
                                number = 1044279; // You repair the item.
                            }
                            else
                            {
                                number = 1044280; // You fail to repair the item.
                            }
                        }
                        else if (targeted is BaseWeapon)
                        {
                            BaseWeapon weapon   = (BaseWeapon)targeted;
                            SkillName  skill    = m_CraftSystem.MainSkill;
                            int        toWeaken = 1;

                            if (m_CraftSystem.CraftItems.SearchForSubclass(weapon.GetType()) == null && !CheckSpecial(weapon))
                            {
                                number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
                            }
                            else if (!weapon.IsChildOf(from.Backpack) && weapon.Parent != from)
                            {
                                number = 1044275; // The item must be in your backpack to repair it.
                            }
                            else if (weapon.MaxHitPoints <= 0 || weapon.HitPoints == weapon.MaxHitPoints)
                            {
                                number = 1044281; // That item is in full repair
                            }
                            else if (weapon.MaxHitPoints <= toWeaken)
                            {
                                number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again.
                            }
                            else if (weapon.NegativeAttributes.NoRepair > 0)
                            {
                                number = 1044277; // That item cannot be repaired.
                            }
                            else
                            {
                                if (CheckWeaken(from, skill, weapon.HitPoints, weapon.MaxHitPoints))
                                {
                                    weapon.MaxHitPoints -= toWeaken;
                                    weapon.HitPoints     = Math.Max(0, weapon.HitPoints - toWeaken);
                                }

                                if (CheckRepairDifficulty(from, skill, weapon.HitPoints, weapon.MaxHitPoints))
                                {
                                    number = 1044279; // You repair the item.
                                    m_CraftSystem.PlayCraftEffect(from);
                                    weapon.HitPoints = weapon.MaxHitPoints;

                                    m_CraftSystem.OnRepair(from, m_Tool, m_Deed, m_Addon, weapon);
                                }
                                else
                                {
                                    number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed]
                                    m_CraftSystem.PlayCraftEffect(from);
                                }

                                toDelete = true;
                            }
                        }
                        else if (targeted is BaseArmor)
                        {
                            BaseArmor armor    = (BaseArmor)targeted;
                            SkillName skill    = m_CraftSystem.MainSkill;
                            int       toWeaken = 1;

                            if (m_CraftSystem.CraftItems.SearchForSubclass(armor.GetType()) == null && !CheckSpecial(armor))
                            {
                                number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
                            }
                            else if (!armor.IsChildOf(from.Backpack) && armor.Parent != from)
                            {
                                number = 1044275; // The item must be in your backpack to repair it.
                            }
                            else if (armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints)
                            {
                                number = 1044281; // That item is in full repair
                            }
                            else if (armor.MaxHitPoints <= toWeaken)
                            {
                                number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again.
                            }
                            else if (armor.NegativeAttributes.NoRepair > 0)
                            {
                                number = 1044277; // That item cannot be repaired.
                            }
                            else
                            {
                                if (CheckWeaken(from, skill, armor.HitPoints, armor.MaxHitPoints))
                                {
                                    armor.MaxHitPoints -= toWeaken;
                                    armor.HitPoints     = Math.Max(0, armor.HitPoints - toWeaken);
                                }

                                if (CheckRepairDifficulty(from, skill, armor.HitPoints, armor.MaxHitPoints))
                                {
                                    number = 1044279; // You repair the item.
                                    m_CraftSystem.PlayCraftEffect(from);
                                    armor.HitPoints = armor.MaxHitPoints;

                                    m_CraftSystem.OnRepair(from, m_Tool, m_Deed, m_Addon, armor);
                                }
                                else
                                {
                                    number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed]
                                    m_CraftSystem.PlayCraftEffect(from);
                                }

                                toDelete = true;
                            }
                        }
                        else if (targeted is BaseJewel)
                        {
                            BaseJewel jewel    = (BaseJewel)targeted;
                            SkillName skill    = m_CraftSystem.MainSkill;
                            int       toWeaken = 1;

                            if (m_CraftSystem.CraftItems.SearchForSubclass(jewel.GetType()) == null && !CheckSpecial(jewel))
                            {
                                number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
                            }
                            else if (!jewel.IsChildOf(from.Backpack))
                            {
                                number = 1044275; // The item must be in your backpack to repair it.
                            }
                            else if (jewel.MaxHitPoints <= 0 || jewel.HitPoints == jewel.MaxHitPoints)
                            {
                                number = 1044281; // That item is in full repair
                            }
                            else if (jewel.MaxHitPoints <= toWeaken)
                            {
                                number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again.
                            }
                            else if (jewel.NegativeAttributes.NoRepair > 0)
                            {
                                number = 1044277; // That item cannot be repaired.
                            }
                            else
                            {
                                if (CheckWeaken(from, skill, jewel.HitPoints, jewel.MaxHitPoints))
                                {
                                    jewel.MaxHitPoints -= toWeaken;
                                    jewel.HitPoints     = Math.Max(0, jewel.HitPoints - toWeaken);
                                }

                                if (CheckRepairDifficulty(from, skill, jewel.HitPoints, jewel.MaxHitPoints))
                                {
                                    number = 1044279; // You repair the item.
                                    m_CraftSystem.PlayCraftEffect(from);
                                    jewel.HitPoints = jewel.MaxHitPoints;

                                    m_CraftSystem.OnRepair(from, m_Tool, m_Deed, m_Addon, jewel);
                                }
                                else
                                {
                                    number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed]
                                    m_CraftSystem.PlayCraftEffect(from);
                                }

                                toDelete = true;
                            }
                        }
                        else if (targeted is BaseClothing)
                        {
                            BaseClothing clothing = (BaseClothing)targeted;
                            SkillName    skill    = m_CraftSystem.MainSkill;
                            int          toWeaken = 1;

                            if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !CheckSpecial(clothing))
                            {
                                number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
                            }
                            else if (!clothing.IsChildOf(from.Backpack) && clothing.Parent != from)
                            {
                                number = 1044275; // The item must be in your backpack to repair it.
                            }
                            else if (clothing.MaxHitPoints <= 0 || clothing.HitPoints == clothing.MaxHitPoints)
                            {
                                number = 1044281; // That item is in full repair
                            }
                            else if (clothing.MaxHitPoints <= toWeaken)
                            {
                                number = 1044278;                              // That item has been repaired many times, and will break if repairs are attempted again.
                            }
                            else if (clothing.NegativeAttributes.NoRepair > 0) // quick fix
                            {
                                number = 1044277;                              // That item cannot be repaired.
                            }
                            else
                            {
                                if (CheckWeaken(from, skill, clothing.HitPoints, clothing.MaxHitPoints))
                                {
                                    clothing.MaxHitPoints -= toWeaken;
                                    clothing.HitPoints     = Math.Max(0, clothing.HitPoints - toWeaken);
                                }

                                if (CheckRepairDifficulty(from, skill, clothing.HitPoints, clothing.MaxHitPoints))
                                {
                                    number = 1044279; // You repair the item.
                                    m_CraftSystem.PlayCraftEffect(from);
                                    clothing.HitPoints = clothing.MaxHitPoints;

                                    m_CraftSystem.OnRepair(from, m_Tool, m_Deed, m_Addon, clothing);
                                }
                                else
                                {
                                    number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed]
                                    m_CraftSystem.PlayCraftEffect(from);
                                }

                                toDelete = true;
                            }
                        }
                        else if (targeted is BaseTalisman)
                        {
                            BaseTalisman talisman = (BaseTalisman)targeted;
                            SkillName    skill    = m_CraftSystem.MainSkill;
                            int          toWeaken = 1;

                            if (!(m_CraftSystem is DefTinkering))
                            {
                                number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
                            }
                            else if (!talisman.IsChildOf(from.Backpack) && talisman.Parent != from)
                            {
                                number = 1044275; // The item must be in your backpack to repair it.
                            }
                            else if (talisman.MaxHitPoints <= 0 || talisman.HitPoints == talisman.MaxHitPoints)
                            {
                                number = 1044281; // That item is in full repair
                            }
                            else if (talisman.MaxHitPoints <= toWeaken)
                            {
                                number = 1044278;         // That item has been repaired many times, and will break if repairs are attempted again.
                            }
                            else if (!talisman.CanRepair) // quick fix
                            {
                                number = 1044277;         // That item cannot be repaired.
                            }
                            else
                            {
                                if (CheckWeaken(from, skill, talisman.HitPoints, talisman.MaxHitPoints))
                                {
                                    talisman.MaxHitPoints -= toWeaken;
                                    talisman.HitPoints     = Math.Max(0, talisman.HitPoints - toWeaken);
                                }

                                if (CheckRepairDifficulty(from, skill, talisman.HitPoints, talisman.MaxHitPoints))
                                {
                                    number = 1044279; // You repair the item.
                                    m_CraftSystem.PlayCraftEffect(from);
                                    talisman.HitPoints = talisman.MaxHitPoints;

                                    m_CraftSystem.OnRepair(from, m_Tool, m_Deed, m_Addon, talisman);
                                }
                                else
                                {
                                    number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed]
                                    m_CraftSystem.PlayCraftEffect(from);
                                }

                                toDelete = true;
                            }
                        }
                        else if (targeted is BlankScroll)
                        {
                            if (!usingDeed)
                            {
                                SkillName skill = m_CraftSystem.MainSkill;

                                if (from.Skills[skill].Value >= 50.0)
                                {
                                    ((BlankScroll)targeted).Consume(1);
                                    RepairDeed deed = new RepairDeed(RepairDeed.GetTypeFor(m_CraftSystem), from.Skills[skill].Value, from);
                                    from.AddToBackpack(deed);

                                    number = 500442; // You create the item and put it in your backpack.
                                }
                                else
                                {
                                    number = 1047005; // You must be at least apprentice level to create a repair service contract.
                                }
                            }
                            else
                            {
                                number = 1061136; // You cannot repair that item with this type of repair contract.
                            }
                        }
                        else
                        {
                            number = 500426; // You can't repair that.
                        }
                    }
                    else
                    {
                        number = 500446; // That is too far away.
                    }
                }
                else
                {
                    number = 500426; // You can't repair that.
                }

                if (!usingDeed)
                {
                    CraftContext context = m_CraftSystem.GetContext(from);
                    from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, number));
                }
                else
                {
                    if (m_Addon != null && !m_Addon.Deleted)
                    {
                        RepairBenchDefinition tool = m_Addon.Tools.Find(x => x.System == m_CraftSystem);

                        tool.Charges--;

                        from.SendGump(new RepairBenchGump(from, m_Addon));

                        from.SendLocalizedMessage(number);
                    }
                    else
                    {
                        from.SendLocalizedMessage(number);

                        if (toDelete)
                        {
                            m_Deed.Delete();
                        }
                    }
                }
            }
コード例 #34
0
        public bool GiveReward(Mobile to)
        {
            Bag bag = new Bag();

            bag.DropItem(new Gold(Utility.RandomMinMax(500, 1000)));

            if (Utility.RandomBool())
            {
                BaseWeapon weapon = Loot.RandomWeapon();

                if (Core.AOS)
                {
                    BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30);
                }
                else
                {
                    weapon.DamageLevel     = (WeaponDamageLevel)RandomMinMaxScaled(2, 3);
                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)RandomMinMaxScaled(2, 3);
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)RandomMinMaxScaled(2, 3);
                }

                bag.DropItem(weapon);
            }
            else
            {
                Item item;

                if (Core.AOS)
                {
                    item = Loot.RandomArmorOrShieldOrJewelry();

                    if (item is BaseArmor)
                    {
                        BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 2, 20, 30);
                    }
                    else if (item is BaseJewel)
                    {
                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 2, 20, 30);
                    }
                }
                else
                {
                    BaseArmor armor = Loot.RandomArmorOrShield();
                    item = armor;

                    armor.ProtectionLevel = (ArmorProtectionLevel)RandomMinMaxScaled(2, 3);
                    armor.Durability      = (ArmorDurabilityLevel)RandomMinMaxScaled(2, 3);
                }

                bag.DropItem(item);
            }

            bag.DropItem(new Obsidian());

            if (to.PlaceInBackpack(bag))
            {
                return(true);
            }
            else
            {
                bag.Delete();
                return(false);
            }
        }
コード例 #35
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseWeapon)
                {
                    BaseWeapon bw        = targeted as BaseWeapon;
                    Container  pack      = from.Backpack;
                    int        toConsume = 0;
                    toConsume = (bw.MaxHitPoints - bw.HitPoints) * 3;         //Adjuct price here by changing 3 to whatever you want.

                    if (toConsume == 0)
                    {
                        m_Blacksmith.SayTo(from, "That weapon is not damaged.");
                    }
                    else if ((bw.HitPoints < bw.MaxHitPoints) && (pack.ConsumeTotal(typeof(Gold), toConsume)))
                    {
                        Item a = from.Backpack.FindItemByType(typeof(Gold));
                        if (a != null)
                        {
                            a.Consume(toConsume);
                        }

                        bw.HitPoints = bw.MaxHitPoints;
                        m_Blacksmith.SayTo(from, "Here is your weapon.");
                        from.SendMessage(String.Format("You pay {0}gp.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x2A);
                    }
                    else
                    {
                        m_Blacksmith.SayTo(from, "It will cost you {0}gp to have your weapon repaired.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }

                if (targeted is BaseArmor)
                {
                    BaseArmor ba        = targeted as BaseArmor;
                    Container pack      = from.Backpack;
                    int       toConsume = 0;
                    toConsume = (ba.MaxHitPoints - ba.HitPoints) * 3;         //Adjuct price here by changing 3 to whatever you want.

                    if ((toConsume == 0) && (ba.Resource == CraftResource.Iron || ba.Resource == CraftResource.DullCopper || ba.Resource == CraftResource.ShadowIron || ba.Resource == CraftResource.Copper || ba.Resource == CraftResource.Bronze || ba.Resource == CraftResource.Gold || ba.Resource == CraftResource.Agapite || ba.Resource == CraftResource.Verite || ba.Resource == CraftResource.Valorite))
                    {
                        m_Blacksmith.SayTo(from, "That armor is not damaged.");
                    }
                    else if (ba.Resource == CraftResource.RegularLeather || ba.Resource == CraftResource.SpinedLeather || ba.Resource == CraftResource.HornedLeather || ba.Resource == CraftResource.BarbedLeather)
                    {
                        m_Blacksmith.SayTo(from, "I cannot repair that.");
                    }
                    else if ((ba.HitPoints < ba.MaxHitPoints) && (pack.ConsumeTotal(typeof(Gold), toConsume) && (ba.Resource == CraftResource.Iron || ba.Resource == CraftResource.DullCopper || ba.Resource == CraftResource.ShadowIron || ba.Resource == CraftResource.Copper || ba.Resource == CraftResource.Bronze || ba.Resource == CraftResource.Gold || ba.Resource == CraftResource.Agapite || ba.Resource == CraftResource.Verite || ba.Resource == CraftResource.Valorite)))
                    {
                        Item a = from.Backpack.FindItemByType(typeof(Gold));
                        if (a != null)
                        {
                            a.Consume(toConsume);
                        }

                        ba.HitPoints = ba.MaxHitPoints;
                        m_Blacksmith.SayTo(from, "Here is your armor.");
                        from.SendMessage(String.Format("You pay {0}gp.", toConsume));
                        Effects.PlaySound(from.Location, from.Map, 0x2A);
                    }
                    else
                    {
                        m_Blacksmith.SayTo(from, "It will cost you {0}gp to have your armor repaired.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
            }
コード例 #36
0
        public static void ApplyAttributesTo(BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance  = luckChance;

            AosAttributes       primary   = weapon.Attributes;
            AosWeaponAttributes secondary = weapon.WeaponAttributes;

            m_Props.SetAll(false);

            if (weapon is BaseRanged)
            {
                m_Props.Set(2, true);                   // ranged weapons cannot be ubws or mageweapon
            }
            if (!(weapon is BaseStaff) && !(weapon is BaseBashing))
            {
                m_Props.Set(9, true);                   // only staves and maces can be spell channeling
            }
            for (int i = 0; i < attributeCount; ++i)
            {
                int random = GetUniqueRandom(24);

                if (random == -1)
                {
                    break;
                }

                switch (random)
                {
                case 0:
                {
                    switch (Utility.Random(5))
                    {
                    case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2); break;

                    case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2); break;

                    case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2); break;

                    case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2); break;

                    case 4: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); break;
                    }

                    break;
                }

                case 1:
                {
                    switch (Utility.Random(4))
                    {
                    case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2); break;

                    case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2); break;

                    case 2: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2); break;

                    case 3: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2); break;
                    }

                    break;
                }

                case 2:
                {
                    switch (Utility.Random(2))
                    {
                    case 0: ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1); break;

                    case 1: ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10); break;
                    }

                    break;
                }

                case  3: ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 50); break;

                case  4: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break;

                case  5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break;

                case  6: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break;

                case  7: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break;

                case  8: ApplyAttribute(primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5); break;

                case  9: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break;

                case 10: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2); break;

                case 11: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, 50, 2); break;

                case 12: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2); break;

                case 13: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2); break;

                case 14: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, 50, 2); break;

                case 15: ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2); break;

                case 16: ApplyAttribute(secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10); break;

                case 17: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15); break;

                case 18: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15); break;

                case 19: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15); break;

                case 20: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15); break;

                case 21: ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15); break;

                case 22: ApplyAttribute(secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10); break;

                case 23: weapon.Slayer = GetRandomSlayer(); break;
                }
            }
        }
コード例 #37
0
        public override void OnCast()
        {
            BaseWeapon wep = GetWeapon();

            if (wep != null && CheckSequence())
            {
                wep.PlaySwingAnimation(Caster);

                TimeSpan duration = TimeSpan.FromMinutes(1);

                double skill = (Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 2;

                _HCIBonus = (int)Math.Max(45, skill / 2.667);
                _SSIBonus = (int)Math.Max(30, skill / 4);

                string args = String.Format("{0}\t{1}\t{2}", Caster.Name, _HCIBonus.ToString(), _SSIBonus.ToString());
                BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.PlayingTheOddsDebuff, 1155913, 1156091, duration, Caster));
                //Your bow range has been reduced as you play the odds.

                foreach (Mobile m in GetParty().Where(mob => mob is PlayerMobile))
                {
                    m.PlaySound(0x101);
                    m.FixedEffect(0x13B2, 10, 20, 2728, 5);
                    m.FixedEffect(0x37C4, 10, 20, 2728, 5);

                    if (m != Caster)
                    {
                        BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PlayingTheOdds, 1155913, 1155998, duration, m, args));
                    }
                    //~1_NAME~ grants you the following:<br>+~2_VAl~% Hit Chance Increase.<br>+~3_VAL~% Swing Speed Increase.
                }

                Caster.SendLocalizedMessage(1156091); // Your bow range has been reduced as you play the odds.

                Expires = DateTime.UtcNow + duration;
                BeginTimer();

                AddToCooldown(TimeSpan.FromSeconds(90));

                IPooledEnumerable eable   = Caster.Map.GetMobilesInRange(Caster.Location, 5);
                List <Mobile>     targets = new List <Mobile>();

                foreach (Mobile m in eable)
                {
                    if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
                    {
                        if (!Caster.InLOS(m))
                        {
                            continue;
                        }

                        targets.Add(m);
                    }
                }
                eable.Free();

                foreach (Mobile mob in targets)
                {
                    if (HitLower.ApplyDefense(mob))
                    {
                        if (wep is BaseRanged && !(wep is BaseThrown))
                        {
                            Caster.MovingEffect(mob, ((BaseRanged)wep).EffectID, 18, 1, false, false);
                        }

                        mob.PlaySound(0x28E);
                        Effects.SendTargetEffect(mob, 0x37BE, 1, 4, 0x23, 3);

                        Caster.DoHarmful(mob);
                    }
                }

                wep.InvalidateProperties();
            }

            FinishSequence();
        }
コード例 #38
0
 //save old info about weapon
 void SaveOldInfo(int index,BaseWeapon gun)
 {
     //Debug.Log (index);
     weaponInfo[index].amount  = gun.curAmmo;
 }
コード例 #39
0
        private static int GetPriceFor(Item item)
        {
            int price = 0;

            if (item is Gold)
            {
                price = item.Amount;
            }
            else if (item is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)item;

                if (armor.Quality == CraftQuality.Low)
                {
                    price = (int)(price * 0.75);
                }
                else if (armor.Quality == CraftQuality.Exceptional)
                {
                    price = (int)(price * 1.25);
                }

                price += 100 * (int)armor.Durability;

                price += 100 * (int)armor.ProtectionLevel;
            }
            else if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                if (weapon.Quality == CraftQuality.Low)
                {
                    price = (int)(price * 0.60);
                }
                else if (weapon.Quality == CraftQuality.Exceptional)
                {
                    price = (int)(price * 1.25);
                }

                price += 100 * (int)weapon.DurabilityLevel;

                price += 100 * (int)weapon.DamageLevel;
            }
            else if (item is BaseBeverage)
            {
                int price1 = price, price2 = price;

                if (item is Pitcher)
                {
                    price1 = 3; price2 = 5;
                }
                else if (item is BeverageBottle)
                {
                    price1 = 3; price2 = 3;
                }
                else if (item is Jug)
                {
                    price1 = 6; price2 = 6;
                }

                BaseBeverage bev = (BaseBeverage)item;

                if (bev.IsEmpty || bev.Content == BeverageType.Milk)
                {
                    price = price1;
                }
                else
                {
                    price = price2;
                }
            }
            else
            {
                price = Utility.RandomMinMax(10, 50);
            }

            if (price < 1)
            {
                price = 1;
            }

            return(price);
        }
コード例 #40
0
 //Change weapon in inventory
 public void ChangePrefab(BaseWeapon newWeapon)
 {
     ChangePrefab (newWeapon, new WeaponBackUp (newWeapon.clipSize, newWeapon.ammoType));
 }
コード例 #41
0
 public override float GetDamage()
 {
     return(BaseWeapon.GetDamage() + DamageModifier);
 }
コード例 #42
0
        public Item Mutate(Mobile from, Item item)
        {
            if (item != null)
            {
                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (80 > Utility.Random(100))
                        {
                            weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
                        }

                        if (60 > Utility.Random(100))
                        {
                            weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus();
                        }

                        if (40 > Utility.Random(100))
                        {
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus();
                        }

                        if (5 > Utility.Random(100))
                        {
                            weapon.Slayer = SlayerName.Silver;
                        }

                        if (from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100))
                        {
                            weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType());
                        }
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (80 > Utility.Random(100))
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
                        }

                        if (40 > Utility.Random(100))
                        {
                            armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
                        }
                    }
                }
                else if (item is BaseInstrument)
                {
                    SlayerName slayer = SlayerName.None;

                    slayer = SlayerGroup.GetLootSlayerType(from.GetType());

                    if (slayer == SlayerName.None)
                    {
                        item.Delete();
                        return(null);
                    }

                    BaseInstrument instr = (BaseInstrument)item;

                    instr.Quality = InstrumentQuality.Regular;
                    instr.Slayer  = slayer;
                }

                if (item.Stackable)
                {
                    item.Amount = m_Quantity.Roll();
                }
            }

            return(item);
        }
コード例 #43
0
ファイル: Enhance.cs プロジェクト: mguerine/runuo-ws
        public static EnhanceResult Invoke(Mobile from, CraftSystem craftSystem, BaseTool tool, Item item, CraftResource resource, Type resType, ref object resMessage)
        {
            if (item == null)
            {
                return(EnhanceResult.BadItem);
            }

            if (!item.IsChildOf(from.Backpack))
            {
                return(EnhanceResult.NotInBackpack);
            }

            if (!(item is BaseArmor) && !(item is BaseWeapon))
            {
                return(EnhanceResult.BadItem);
            }

            if (CraftResources.IsStandard(resource))
            {
                return(EnhanceResult.BadResource);
            }

            int num = craftSystem.CanCraft(from, tool, item.GetType());

            if (num > 0)
            {
                resMessage = num;
                return(EnhanceResult.None);
            }

            CraftItem craftItem = craftSystem.CraftItems.SearchFor(item.GetType());

            if (craftItem == null || craftItem.Resources.Count == 0)
            {
                return(EnhanceResult.BadItem);
            }

            #region Mondain's Legacy
            if (craftItem.ForceNonExceptional)
            {
                return(EnhanceResult.BadItem);
            }
            #endregion

            bool allRequiredSkills = false;
            if (craftItem.GetSuccessChance(from, resType, craftSystem, false, ref allRequiredSkills) <= 0.0)
            {
                return(EnhanceResult.NoSkill);
            }

            CraftResourceInfo info = CraftResources.GetInfo(resource);

            if (info == null || info.ResourceTypes.Length == 0)
            {
                return(EnhanceResult.BadResource);
            }

            CraftAttributeInfo attributes = info.AttributeInfo;

            if (attributes == null)
            {
                return(EnhanceResult.BadResource);
            }

            int resHue = 0, maxAmount = 0;

            if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref resMessage))
            {
                return(EnhanceResult.NoResources);
            }

            if (craftSystem is DefBlacksmithy)
            {
                AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer;
                if (hammer != null)
                {
                    hammer.UsesRemaining--;
                    if (hammer.UsesRemaining < 1)
                    {
                        hammer.Delete();
                    }
                }
            }

            int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0;
            int dura = 0, luck = 0, lreq = 0, dinc = 0;
            int baseChance = 0;

            bool physBonus = false;
            bool fireBonus = false;
            bool coldBonus = false;
            bool nrgyBonus = false;
            bool poisBonus = false;
            bool duraBonus = false;
            bool luckBonus = false;
            bool lreqBonus = false;
            bool dincBonus = false;

            if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                if (!CraftResources.IsStandard(weapon.Resource))
                {
                    return(EnhanceResult.AlreadyEnhanced);
                }

                baseChance = 20;

                dura = weapon.MaxHitPoints;
                luck = weapon.Attributes.Luck;
                lreq = weapon.WeaponAttributes.LowerStatReq;
                dinc = weapon.Attributes.WeaponDamage;

                fireBonus = (attributes.WeaponFireDamage > 0);
                coldBonus = (attributes.WeaponColdDamage > 0);
                nrgyBonus = (attributes.WeaponEnergyDamage > 0);
                poisBonus = (attributes.WeaponPoisonDamage > 0);

                duraBonus = (attributes.WeaponDurability > 0);
                luckBonus = (attributes.WeaponLuck > 0);
                lreqBonus = (attributes.WeaponLowerRequirements > 0);
                dincBonus = (dinc > 0);
            }
            else
            {
                BaseArmor armor = (BaseArmor)item;

                if (!CraftResources.IsStandard(armor.Resource))
                {
                    return(EnhanceResult.AlreadyEnhanced);
                }

                baseChance = 20;

                phys = armor.PhysicalResistance;
                fire = armor.FireResistance;
                cold = armor.ColdResistance;
                pois = armor.PoisonResistance;
                nrgy = armor.EnergyResistance;

                dura = armor.MaxHitPoints;
                luck = armor.Attributes.Luck;
                lreq = armor.ArmorAttributes.LowerStatReq;

                physBonus = (attributes.ArmorPhysicalResist > 0);
                fireBonus = (attributes.ArmorFireResist > 0);
                coldBonus = (attributes.ArmorColdResist > 0);
                nrgyBonus = (attributes.ArmorEnergyResist > 0);
                poisBonus = (attributes.ArmorPoisonResist > 0);

                duraBonus = (attributes.ArmorDurability > 0);
                luckBonus = (attributes.ArmorLuck > 0);
                lreqBonus = (attributes.ArmorLowerRequirements > 0);
                dincBonus = false;
            }

            int skill = from.Skills[craftSystem.MainSkill].Fixed / 10;

            if (skill >= 100)
            {
                baseChance -= (skill - 90) / 10;
            }

            EnhanceResult res = EnhanceResult.Success;

            if (physBonus)
            {
                CheckResult(ref res, baseChance + phys);
            }

            if (fireBonus)
            {
                CheckResult(ref res, baseChance + fire);
            }

            if (coldBonus)
            {
                CheckResult(ref res, baseChance + cold);
            }

            if (nrgyBonus)
            {
                CheckResult(ref res, baseChance + nrgy);
            }

            if (poisBonus)
            {
                CheckResult(ref res, baseChance + pois);
            }

            if (duraBonus)
            {
                CheckResult(ref res, baseChance + (dura / 40));
            }

            if (luckBonus)
            {
                CheckResult(ref res, baseChance + 10 + (luck / 2));
            }

            if (lreqBonus)
            {
                CheckResult(ref res, baseChance + (lreq / 4));
            }

            if (dincBonus)
            {
                CheckResult(ref res, baseChance + (dinc / 4));
            }

            switch (res)
            {
            case EnhanceResult.Broken:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                item.Delete();
                break;
            }

            case EnhanceResult.Success:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                if (item is BaseWeapon)
                {
                    BaseWeapon w = (BaseWeapon)item;

                    w.Resource = resource;

                    #region Mondain's Legacy
                    if (resource != CraftResource.Heartwood)
                    {
                        w.Attributes.WeaponDamage       += attributes.WeaponDamage;
                        w.Attributes.WeaponSpeed        += attributes.WeaponSwingSpeed;
                        w.Attributes.AttackChance       += attributes.WeaponHitChance;
                        w.Attributes.RegenHits          += attributes.WeaponRegenHits;
                        w.WeaponAttributes.HitLeechHits += attributes.WeaponHitLifeLeech;
                    }
                    else
                    {
                        switch (Utility.Random(6))
                        {
                        case 0: w.Attributes.WeaponDamage += attributes.WeaponDamage; break;

                        case 1: w.Attributes.WeaponSpeed += attributes.WeaponSwingSpeed; break;

                        case 2: w.Attributes.AttackChance += attributes.WeaponHitChance; break;

                        case 3: w.Attributes.Luck += attributes.WeaponLuck; break;

                        case 4: w.WeaponAttributes.LowerStatReq += attributes.WeaponLowerRequirements; break;

                        case 5: w.WeaponAttributes.HitLeechHits += attributes.WeaponHitLifeLeech; break;
                        }
                    }
                    #endregion

                    int hue = w.GetElementalDamageHue();
                    if (hue > 0)
                    {
                        w.Hue = hue;
                    }
                }
                #region Mondain's Legacy
                else if (item is BaseShield)
                {
                    BaseShield shield = (BaseShield)item;

                    shield.Resource = resource;

                    switch (resource)
                    {
                    case CraftResource.AshWood:
                        shield.ArmorAttributes.LowerStatReq += 20;
                        break;

                    case CraftResource.YewWood:
                        shield.Attributes.RegenHits += 1;
                        break;

                    case CraftResource.Heartwood:
                        switch (Utility.Random(7))
                        {
                        case 0: shield.Attributes.BonusDex += 2; break;

                        case 1: shield.Attributes.BonusStr += 2; break;

                        case 2: shield.Attributes.ReflectPhysical += 5; break;

                        case 3: shield.Attributes.SpellChanneling = 1; shield.Attributes.CastSpeed = -1; break;

                        case 4: shield.ArmorAttributes.SelfRepair += 2; break;

                        case 5: shield.PhysicalBonus += 5; break;

                        case 6: shield.ColdBonus += 3; break;
                        }
                        break;

                    case CraftResource.Bloodwood:
                        shield.Attributes.RegenHits += 2;
                        shield.Attributes.Luck      += 40;
                        break;

                    case CraftResource.Frostwood:
                        shield.Attributes.SpellChanneling = 1;
                        shield.Attributes.CastSpeed       = -1;
                        break;
                    }
                }
                #endregion
                else if (item is BaseArmor)                             //Sanity
                {
                    ((BaseArmor)item).Resource = resource;

                    #region Mondain's Legacy
                    BaseArmor armor = (BaseArmor)item;

                    if (resource != CraftResource.Heartwood)
                    {
                        armor.Attributes.WeaponDamage   += attributes.ArmorDamage;
                        armor.Attributes.AttackChance   += attributes.ArmorHitChance;
                        armor.Attributes.RegenHits      += attributes.ArmorRegenHits;
                        armor.ArmorAttributes.MageArmor += attributes.ArmorMage;
                    }
                    else
                    {
                        switch (Utility.Random(5))
                        {
                        case 0: armor.Attributes.WeaponDamage += attributes.ArmorDamage; break;

                        case 1: armor.Attributes.AttackChance += attributes.ArmorHitChance; break;

                        case 2: armor.ArmorAttributes.MageArmor += attributes.ArmorMage; break;

                        case 3: armor.Attributes.Luck += attributes.ArmorLuck; break;

                        case 4: armor.ArmorAttributes.LowerStatReq += attributes.ArmorLowerRequirements; break;
                        }
                    }
                    #endregion
                }

                break;
            }

            case EnhanceResult.Failure:
            {
                if (!craftItem.ConsumeRes(from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage))
                {
                    return(EnhanceResult.NoResources);
                }

                break;
            }
            }

            return(res);
        }
コード例 #44
0
ファイル: ArcaneGem.cs プロジェクト: tflynt91/TrueUO
        public void OnTarget(Mobile from, object obj)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042010); // You must have the object in your backpack to use it.
                return;
            }

            if (obj is IArcaneEquip && obj is Item)
            {
                Item          item     = (Item)obj;
                CraftResource resource = CraftResource.None;

                if (item is BaseClothing)
                {
                    resource = ((BaseClothing)item).Resource;
                }
                else if (item is BaseArmor)
                {
                    resource = ((BaseArmor)item).Resource;
                }
                else if (item is BaseWeapon) // Sanity, weapons cannot recieve gems...
                {
                    resource = ((BaseWeapon)item).Resource;
                }

                IArcaneEquip eq = (IArcaneEquip)obj;

                if (!item.IsChildOf(from.Backpack))
                {
                    from.SendMessage("You may only target items in your backpack.");
                    return;
                }

                int charges = GetChargesFor(from);

                if (eq.IsArcane)
                {
                    if (eq.CurArcaneCharges > 0)
                    {
                        from.SendMessage("This item still has charges left.");
                    }
                    else
                    {
                        item.Hue = eq.TempHue;

                        if (charges >= eq.MaxArcaneCharges)
                        {
                            eq.CurArcaneCharges = eq.MaxArcaneCharges;
                            from.SendMessage("Your skill in tailoring allows you to fully recharge the item.");
                        }
                        else
                        {
                            eq.CurArcaneCharges += charges;
                            from.SendMessage("You are only able to restore some of the charges.");
                        }

                        Consume();
                    }
                }
                else if (from.Skills[SkillName.Tailoring].Value >= 60.0)
                {
                    bool isExceptional = false;

                    if (item is BaseClothing)
                    {
                        isExceptional = ((BaseClothing)item).Quality == ItemQuality.Exceptional;
                    }
                    else if (item is BaseArmor)
                    {
                        isExceptional = ((BaseArmor)item).Quality == ItemQuality.Exceptional;
                    }
                    else if (item is BaseWeapon)
                    {
                        isExceptional = ((BaseWeapon)item).Quality == ItemQuality.Exceptional;
                    }

                    if (isExceptional)
                    {
                        if (item is BaseClothing)
                        {
                            BaseClothing cloth = item as BaseClothing;

                            cloth.Quality = ItemQuality.Normal;
                            cloth.Crafter = from;
                        }
                        else if (item is BaseArmor)
                        {
                            BaseArmor armor = item as BaseArmor;

                            if (armor.IsImbued || armor.IsArtifact || RunicReforging.GetArtifactRarity(armor) > 0)
                            {
                                from.SendLocalizedMessage(1049690); // Arcane gems cannot be used on that type of leather.
                                return;
                            }

                            armor.Quality       = ItemQuality.Normal;
                            armor.Crafter       = from;
                            armor.PhysicalBonus = 0;
                            armor.FireBonus     = 0;
                            armor.ColdBonus     = 0;
                            armor.PoisonBonus   = 0;
                            armor.EnergyBonus   = 0;
                        }
                        else if (item is BaseWeapon) // Sanity, weapons cannot recieve gems...
                        {
                            BaseWeapon weapon = item as BaseWeapon;

                            weapon.Quality = ItemQuality.Normal;
                            weapon.Crafter = from;
                        }

                        eq.CurArcaneCharges = eq.MaxArcaneCharges = charges;

                        item.Hue = DefaultArcaneHue;

                        if (item.LootType == LootType.Blessed)
                        {
                            item.LootType = LootType.Regular;
                        }

                        Consume();
                    }
                    else
                    {
                        from.SendMessage("You can only use this on exceptionally crafted robes, thigh boots, cloaks, or leather gloves.");
                    }
                }
                else
                {
                    from.SendMessage("You do not have enough skill in tailoring to use this.");
                }
            }
            else
            {
                from.SendMessage("You can only use this on exceptionally crafted robes, thigh boots, cloaks, or leather gloves.");
            }
        }
コード例 #45
0
ファイル: InfectiousStrike.cs プロジェクト: nogu3ira/xrunuo
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            Poison p = weapon.Poison;

            if (p == null || weapon.PoisonCharges <= 0)
            {
                attacker.SendLocalizedMessage(1061141);                   // Your weapon must have a dose of poison to perform an infectious strike!
                return;
            }

            if (!CheckMana(attacker, true))
            {
                return;
            }

            --weapon.PoisonCharges;

            // Infectious strike special move now uses poisoning skill to help determine potency
            int maxLevel = attacker.Skills[SkillName.Poisoning].Fixed / 200;

            if (maxLevel < 0)
            {
                maxLevel = 0;
            }
            if (p.Level > maxLevel)
            {
                p = Poison.GetPoison(maxLevel);
            }

            Poison oldPoison = p;

            if ((attacker.Skills[SkillName.Poisoning].Value / 100.0) > Utility.RandomDouble())
            {
                int    level     = p.Level + 1;
                Poison newPoison = Poison.GetPoison(level);

                if (newPoison != null)
                {
                    p = newPoison;

                    attacker.SendLocalizedMessage(1060080);                       // Your precise strike has increased the level of the poison by 1
                    defender.SendLocalizedMessage(1060081);                       // The poison seems extra effective!
                }
            }

            defender.PlaySound(0xDD);
            defender.FixedParticles(0x3728, 244, 25, 9941, 1266, 0, EffectLayer.Waist);

            if (defender.ApplyPoison(attacker, p) != ApplyPoisonResult.Immune)
            {
                attacker.SendLocalizedMessage(1008096, true, defender.Name);                   // You have poisoned your target :
                defender.SendLocalizedMessage(1008097, false, attacker.Name);                  //  : poisoned you!

                Titles.AwardKarma(attacker, -10, true);

                if (oldPoison.Name == "Parasitic")
                {
                    ParasiticPotion.AddInfo(defender, attacker);
                }
                else if (oldPoison.Name == "Darkglow")
                {
                    DarkglowPotion.AddInfo(defender, attacker);
                }
            }
        }
コード例 #46
0
 public override string GetWeaponName()
 {
     return(WeaponNameModifier + BaseWeapon.GetWeaponName());
 }
コード例 #47
0
    protected void _ChangeWeapon(int newWeapon)
    {
        if(prefabWeapon.Length<=newWeapon){
            Debug.Log("Selected weapon doesn't exist in current inventory manager");
            return;
        }
        BaseWeapon firstWeapon;
        if (owner.photonView.isSceneView)
        {
            firstWeapon = PhotonNetwork.InstantiateSceneObject(prefabWeapon[newWeapon].name, transform.position, Quaternion.identity, 0, null).GetComponent<BaseWeapon>();
            Debug.Log("Turret weapon spawn");
        }
        else
        {
            firstWeapon = PhotonNetwork.Instantiate(prefabWeapon[newWeapon].name, transform.position, Quaternion.identity, 0).GetComponent<BaseWeapon>();
        }

        owner.setWeapon(firstWeapon);
        if(currentWeapon!=null){
            if(indexWeapon!=newWeapon){
                SaveOldInfo(indexWeapon,currentWeapon);
            }
            currentWeapon.RequestKillMe();
        }

        //TakeWeaponAway ();
        indexWeapon=newWeapon;
        currentWeapon=firstWeapon;
        owner.setWeapon(firstWeapon);
        LoadOldInfo();
    }
コード例 #48
0
        public bool IsUpgradable(Item itemToTest)
        {
            bool allowed = true;

            if (itemToTest is BaseShield)
            {
                BaseShield shield = (BaseShield)itemToTest;

                if (shield.ArtifactRarity > 0)
                {
                    allowed = false;
                }

                if (Name == "AttackChance" && Core.ML)
                {
                    allowed = false;
                }

                if (Name == "ReflectPhysical" && !Core.ML)
                {
                    allowed = false;
                }

                if (Name == "LowerStatReq" && (!Core.AOS || (shield.Resource >= CraftResource.RegularLeather && shield.Resource <= CraftResource.BarbedLeather)))
                {
                    allowed = false;
                }

                if (!AllowShield)
                {
                    allowed = false;
                }
            }
            else if (itemToTest is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)itemToTest;

                if (armor.ArtifactRarity > 0)
                {
                    allowed = false;
                }

                if (Name == "LowerStatReq" && (!Core.AOS || (armor.Resource >= CraftResource.RegularLeather && armor.Resource <= CraftResource.BarbedLeather)))
                {
                    allowed = false;
                }

                if (Name == "MageArmor" && armor.MeditationAllowance == ArmorMeditationAllowance.All)
                {
                    allowed = false;
                }

                if (Name == "NightSight" && armor.RequiredRace == Race.Elf)
                {
                    allowed = false;
                }

                if (!AllowArmor)
                {
                    allowed = false;
                }
            }
            else if (itemToTest is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)itemToTest;

                if (weapon.ArtifactRarity > 0)
                {
                    allowed = false;
                }

                if (Name == "UseBestSkill" && weapon.WeaponAttributes.MageWeapon > 0)
                {
                    allowed = false;
                }

                if (Name == "MageWeapon" && weapon.WeaponAttributes.UseBestSkill > 0)
                {
                    allowed = false;
                }

                if (Name == "HitPhysicalArea" && (weapon.WeaponAttributes.HitFireArea > 0 || weapon.WeaponAttributes.HitColdArea > 0 ||
                                                  weapon.WeaponAttributes.HitPoisonArea > 0 || weapon.WeaponAttributes.HitEnergyArea > 0))
                {
                    allowed = false;
                }

                if (Name == "HitFireArea" && (weapon.WeaponAttributes.HitPhysicalArea > 0 || weapon.WeaponAttributes.HitColdArea > 0 ||
                                              weapon.WeaponAttributes.HitPoisonArea > 0 || weapon.WeaponAttributes.HitEnergyArea > 0))
                {
                    allowed = false;
                }

                if (Name == "HitColdArea" && (weapon.WeaponAttributes.HitFireArea > 0 || weapon.WeaponAttributes.HitPhysicalArea > 0 ||
                                              weapon.WeaponAttributes.HitPoisonArea > 0 || weapon.WeaponAttributes.HitEnergyArea > 0))
                {
                    allowed = false;
                }

                if (Name == "HitPoisonArea" && (weapon.WeaponAttributes.HitFireArea > 0 || weapon.WeaponAttributes.HitColdArea > 0 ||
                                                weapon.WeaponAttributes.HitPhysicalArea > 0 || weapon.WeaponAttributes.HitEnergyArea > 0))
                {
                    allowed = false;
                }

                if (Name == "HitEnergyArea" && (weapon.WeaponAttributes.HitFireArea > 0 || weapon.WeaponAttributes.HitColdArea > 0 ||
                                                weapon.WeaponAttributes.HitPoisonArea > 0 || weapon.WeaponAttributes.HitPhysicalArea > 0))
                {
                    allowed = false;
                }

                if (Name == "HitMagicArrow" && (weapon.WeaponAttributes.HitHarm > 0 || weapon.WeaponAttributes.HitFireball > 0 ||
                                                weapon.WeaponAttributes.HitLightning > 0))
                {
                    allowed = false;
                }

                if (Name == "HitHarm" && (weapon.WeaponAttributes.HitMagicArrow > 0 || weapon.WeaponAttributes.HitFireball > 0 ||
                                          weapon.WeaponAttributes.HitLightning > 0))
                {
                    allowed = false;
                }

                if (Name == "HitFireball" && (weapon.WeaponAttributes.HitHarm > 0 || weapon.WeaponAttributes.HitMagicArrow > 0 ||
                                              weapon.WeaponAttributes.HitLightning > 0))
                {
                    allowed = false;
                }

                if (Name == "HitLightning" && (weapon.WeaponAttributes.HitHarm > 0 || weapon.WeaponAttributes.HitFireball > 0 ||
                                               weapon.WeaponAttributes.HitMagicArrow > 0))
                {
                    allowed = false;
                }

                if (!AllowWeapon)
                {
                    allowed = false;
                }
            }
            else if (itemToTest is BaseJewel)
            {
                BaseJewel jewel = (BaseJewel)itemToTest;

                if (jewel.ArtifactRarity > 0)
                {
                    allowed = false;
                }

                if (!AllowJewelry)
                {
                    allowed = false;
                }
            }
            else if (itemToTest is BaseClothing)
            {
                BaseClothing cloth = (BaseClothing)itemToTest;

                if (cloth.ArtifactRarity > 0)
                {
                    allowed = false;
                }

                if (!AllowClothing)
                {
                    allowed = false;
                }
            }
            else if (itemToTest is Spellbook)
            {
                if (!AllowSpellbook)
                {
                    allowed = false;
                }
            }
            else
            {
                allowed = false;
            }

            if (allowed)
            {
                int currentValue = Upgrade(itemToTest, true);

                if (currentValue == MaxValue)
                {
                    allowed = false;
                }
            }

            return(allowed);
        }
コード例 #49
0
 //Load needed weapon info
 void LoadOldInfo(int index,BaseWeapon gun)
 {
     gun.curAmmo=weaponInfo[index].amount;
 }
コード例 #50
0
ファイル: EnchantSpell .cs プロジェクト: ygtkms/ServUO
        public override void OnCast()
        {
            BaseWeapon wep = Caster.Weapon as BaseWeapon;

            if (wep == null || wep != Weapon)
            {
                Caster.SendLocalizedMessage(501078); // You must be holding a weapon.
            }
            else if (IsUnderSpellEffects(Caster, Weapon))
            {
                Caster.SendLocalizedMessage(501775); // This spell is already in effect.
            }
            else if (ImmolatingWeaponSpell.IsImmolating(Caster, Weapon) || Weapon.ConsecratedContext != null)
            {
                Caster.SendLocalizedMessage(1080128); //You cannot use this ability while your weapon is enchanted.
            }
            else if (Weapon.FocusWeilder != null)
            {
                Caster.SendLocalizedMessage(1080446); // You cannot enchant an item that is under the effects of the ninjitsu focus attack ability.
            }
            else if (Weapon.WeaponAttributes.HitLightning > 0 || Weapon.WeaponAttributes.HitFireball > 0 || Weapon.WeaponAttributes.HitHarm > 0 || Weapon.WeaponAttributes.HitMagicArrow > 0 || Weapon.WeaponAttributes.HitDispel > 0)
            {
                Caster.SendLocalizedMessage(1080127); // This weapon already has a hit spell effect and cannot be enchanted.
            }
            else if (CheckSequence() && Caster.Weapon == Weapon)
            {
                Caster.PlaySound(0x64E);
                Caster.FixedEffect(0x36CB, 1, 9, 1915, 0);

                int prim = (int)Caster.Skills[CastSkill].Value;
                int sec  = (int)Caster.Skills[DamageSkill].Value;

                int    value    = (60 * (prim + sec)) / 240;
                double duration = ((prim + sec) / 2.0) + 30.0;
                int    malus    = 0;

                if (Table == null)
                {
                    Table = new Dictionary <Mobile, EnchantmentTimer>();
                }

                Enhancement.SetValue(Caster, Attribute, value, ModName);

                if (prim >= 80 && sec >= 80 && Weapon.Attributes.SpellChanneling == 0)
                {
                    Enhancement.SetValue(Caster, AosAttribute.SpellChanneling, 1, ModName);
                    Enhancement.SetValue(Caster, AosAttribute.CastSpeed, -1, ModName);
                    malus = 1;
                }

                Table[Caster] = new EnchantmentTimer(Caster, Weapon, Attribute, value, malus, duration);

                int loc;

                switch (Attribute)
                {
                default:
                case AosWeaponAttribute.HitLightning: loc = 1060423; break;

                case AosWeaponAttribute.HitFireball: loc = 1060420; break;

                case AosWeaponAttribute.HitHarm: loc = 1060421; break;

                case AosWeaponAttribute.HitMagicArrow: loc = 1060426; break;

                case AosWeaponAttribute.HitDispel: loc = 1060417; break;
                }

                BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Enchant, 1080126, loc, TimeSpan.FromSeconds(duration), Caster, value.ToString()));

                Weapon.EnchantedWeilder = Caster;
                Weapon.InvalidateProperties();
            }

            FinishSequence();
        }
コード例 #51
0
        public override void OnHit(Mobile defender, ref int damage)
        {
            BaseWeapon weapon = GetWeapon();

            if (!CheckWeapon())
            {
                return;
            }

            Poison p = weapon.Poison;

            if (p == null || weapon.PoisonCharges <= 0)
            {
                Caster.SendLocalizedMessage(1061141); // Your weapon must have a dose of poison to perform an infectious strike!
                return;
            }

            // Skill Masteries
            int noChargeChance = MasteryInfo.NonPoisonConsumeChance(Caster);

            if (noChargeChance == 0 || noChargeChance < Utility.Random(100))
            {
                --weapon.PoisonCharges;
            }
            else
            {
                Caster.SendLocalizedMessage(1156095); // Your mastery of poisoning allows you to use your poison charge without consuming it.
            }
            int maxLevel = Caster.Skills[SkillName.Poisoning].Fixed / 200;

            if (maxLevel < 0)
            {
                maxLevel = 0;
            }

            #region Mondain's Legacy
            if (p == Poison.DarkGlow)
            {
                p = Poison.GetPoison(10 + Math.Min(maxLevel, 2));
            }
            else if (p == Poison.Parasitic)
            {
                p = Poison.GetPoison(14 + Math.Min(maxLevel, 3));
            }
            else if (p.Level > maxLevel)
            {
                p = Poison.GetPoison(maxLevel);
            }
            #endregion

            if ((Caster.Skills[SkillName.Poisoning].Value / 100.0) > Utility.RandomDouble() && p.Level < 3)
            {
                int    level     = p.Level + 1;
                Poison newPoison = Poison.GetPoison(level);

                if (newPoison != null)
                {
                    p = newPoison;

                    Caster.SendLocalizedMessage(1060080);   // Your precise strike has increased the level of the poison by 1
                    defender.SendLocalizedMessage(1060081); // The poison seems extra effective!
                }
            }

            defender.PlaySound(0xDD);
            defender.FixedParticles(0x3728, 244, 25, 9941, 1266, 0, EffectLayer.Waist);

            if (defender.ApplyPoison(Caster, p) != ApplyPoisonResult.Immune)
            {
                Caster.SendLocalizedMessage(1008096, true, defender.Name);  // You have poisoned your target :
                defender.SendLocalizedMessage(1008097, false, Caster.Name); //  : poisoned you!
            }

            int malus = 30;

            if (defender is PlayerMobile)
            {
                malus /= 2;
            }

            if (weapon is BaseRanged)
            {
                malus /= 2;
            }

            ResistanceMod mod = new ResistanceMod(ResistanceType.Poison, -malus);
            defender.AddResistanceMod(mod);

            // ~2_NAME~ reduces your poison resistance by ~1_VAL~.
            BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.InjectedStrikeDebuff, 1155927, 1156133, TimeSpan.FromSeconds(7), defender, String.Format("{0}\t{1}", malus, Caster.Name)));

            Server.Timer.DelayCall(TimeSpan.FromSeconds(7), () =>
            {
                defender.RemoveResistanceMod(mod);
            });

            Expire();
        }
コード例 #52
0
 public override void OnWeaponRemoved(BaseWeapon weapon)
 {
     Expire();
 }
コード例 #53
0
 // Use this for initialization
 void Start()
 {
     weapon_script = transform.parent.GetComponent<BaseWeapon>();
     _gunOrigin = transform.parent;
     transform.parent = null;
 }
コード例 #54
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0; // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1:
                    cont.RequiredSkill = 36;
                    break;

                case 2:
                    cont.RequiredSkill = 76;
                    break;

                case 3:
                    cont.RequiredSkill = 84;
                    break;

                case 4:
                    cont.RequiredSkill = 92;
                    break;

                case 5:
                    cont.RequiredSkill = 100;
                    break;

                case 6:
                    cont.RequiredSkill = 100;
                    break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                //Publish 67 gold change
                //if ( Core.SA )
                //	cont.DropItem( new Gold( level * 5000 ) );
                //else
                cont.DropItem(new Gold(level * 1000));

                for (int i = 0; i < level * 5; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }

                if (Core.SE)
                {
                    switch (level)
                    {
                    case 1:
                        numberItems = 5;
                        break;

                    case 2:
                        numberItems = 10;
                        break;

                    case 3:
                        numberItems = 15;
                        break;

                    case 4:
                        numberItems = 38;
                        break;

                    case 5:
                        numberItems = 50;
                        break;

                    case 6:
                        numberItems = 60;
                        break;

                    default:
                        numberItems = 0;
                        break;
                    }
                }
                else
                {
                    numberItems = level * 6;
                }

                for (int i = 0; i < numberItems; ++i)
                {
                    Item item;

                    if (Core.AOS)
                    {
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                    }
                    else
                    {
                        item = Loot.RandomArmorOrShieldOrWeapon();
                    }

                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                        }
                        else
                        {
                            weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                            weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level * 3;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = level * 3;
            }

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }

            if (level == 6 && Core.AOS)
            {
                cont.DropItem((Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]));
            }
        }
コード例 #55
0
 // Use this for initialization
 void Start()
 {
     foreach (Transform child in transform)
     {
         if (child.tag == _animTag)
         {
             anim = child.GetComponent<Animator>();
             break;
         }
     }
     hp = maxHp;
     hpIndicator = GetComponentInChildren<CanvasObjectFollowGameObject>();
     weapon = GetComponent<BaseWeapon>();
     BaseArmor tempArmorVar = GetComponent<BaseArmor>();
     resist = tempArmorVar.resist;
     vunerable = tempArmorVar.vunerable;
     hpIndicator.ChangeText(hp);
     turnhandler = GameObject.FindGameObjectWithTag(_turnHandler).GetComponent<TurnHandler>();
 }
コード例 #56
0
        protected override void OnTarget(Mobile from, object target)
        {
            if (target is Mobile)
            {
                from.SendLocalizedMessage(500507); // You can only bless an item!
            }
            else if (target is BaseArmor || target is BaseClothing || target is BaseWeapon || target is BaseJewel)
            {
                Item item = (Item)target;

                if (item.LootType == LootType.Blessed || item.BlessedFor != null || (Mobile.InsuranceEnabled && item.Insured)) // Check if its already newbied (blessed)
                {
                    from.SendLocalizedMessage(1045113);                                                                        // That item is already blessed
                }
                else if (item.LootType != LootType.Regular)
                {
                    from.SendLocalizedMessage(500509); // You can't bless this object!
                }
                else if (item.RootParent != from)      // Make sure its in their pack or they are wearing it
                {
                    from.SendLocalizedMessage(500508); // You may only bless objects that you are carrying.
                }
                else if (m_Deed.RootParent != from)
                {
                    from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it.
                }
                else
                {
                    // Now we also know the deed is still in the players backpack,
                    // as is the item the player wants to bless. Let's go and
                    // bless it.
                    if (item is BaseArmor)
                    {
                        BaseArmor mitem = (BaseArmor)item;
                        mitem.BlessedBy = from;
                    }
                    else if (item is BaseClothing)
                    {
                        BaseClothing mitem = (BaseClothing)item;
                        mitem.BlessedBy = from;
                    }
                    else if (item is BaseWeapon)
                    {
                        BaseWeapon mitem = (BaseWeapon)item;
                        mitem.BlessedBy = from;
                    }
                    else if (item is BaseJewel)
                    {
                        BaseJewel mitem = (BaseJewel)item;
                        mitem.BlessedBy = from;
                    }

                    item.BlessedFor = from;
                    from.SendLocalizedMessage(1062204); // You personally bless the item for this character.
                    from.PlaySound(0x202);
                    m_Deed.Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(500509); // You can't bless this object!
            }
        }
コード例 #57
0
    public void Init(Vector2 direction, Quaternion rotation, float speed, int damage, BaseWeapon weapon)
    {
        Init(direction,rotation,speed,damage);
        this.weapon = weapon;

    }
コード例 #58
0
ファイル: XmlAttachment.cs プロジェクト: zerodowned/annox
        /*
         * public virtual void OnSkillUse( Mobile m, Skill skill, bool success)
         * {
         * }
         */

        public virtual void OnWeaponHit(Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven)
        {
        }
コード例 #59
0
        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            Direction = GetDirectionTo(player);

            QuestSystem qs = player.Quest;

            if (qs is WitchApprenticeQuest)
            {
                if (qs.IsObjectiveInProgress(typeof(FindApprenticeObjective)))
                {
                    PlaySound(0x259);
                    PlaySound(0x206);
                    qs.AddConversation(new HagDuringCorpseSearchConversation());
                }
                else
                {
                    QuestObjective obj = qs.FindObjective(typeof(FindGrizeldaAboutMurderObjective));

                    if (obj != null && !obj.Completed)
                    {
                        PlaySound(0x420);
                        PlaySound(0x20);
                        obj.Complete();
                    }
                    else if (qs.IsObjectiveInProgress(typeof(KillImpsObjective)) ||
                             qs.IsObjectiveInProgress(typeof(FindZeefzorpulObjective)))
                    {
                        PlaySound(0x259);
                        PlaySound(0x206);
                        qs.AddConversation(new HagDuringImpSearchConversation());
                    }
                    else
                    {
                        obj = qs.FindObjective(typeof(ReturnRecipeObjective));

                        if (obj != null && !obj.Completed)
                        {
                            PlaySound(0x258);
                            PlaySound(0x41B);
                            obj.Complete();
                        }
                        else if (qs.IsObjectiveInProgress(typeof(FindIngredientObjective)))
                        {
                            PlaySound(0x259);
                            PlaySound(0x206);
                            qs.AddConversation(new HagDuringIngredientsConversation());
                        }
                        else
                        {
                            obj = qs.FindObjective(typeof(ReturnIngredientsObjective));

                            if (obj != null && !obj.Completed)
                            {
                                Container cont = GetNewContainer();

                                cont.DropItem(new BlackPearl(30));
                                cont.DropItem(new Bloodmoss(30));
                                cont.DropItem(new Garlic(30));
                                cont.DropItem(new Ginseng(30));
                                cont.DropItem(new MandrakeRoot(30));
                                cont.DropItem(new Nightshade(30));
                                cont.DropItem(new SulfurousAsh(30));
                                cont.DropItem(new SpidersSilk(30));

                                cont.DropItem(new Cauldron());
                                cont.DropItem(new MoonfireBrew());
                                cont.DropItem(new TreasureMap(Utility.RandomMinMax(1, 4), Map));
                                cont.DropItem(new Gold(2000, 2200));

                                if (Utility.RandomBool())
                                {
                                    BaseWeapon weapon = Loot.RandomWeapon();

                                    BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30);

                                    cont.DropItem(weapon);
                                }
                                else
                                {
                                    Item item;

                                    item = Loot.RandomArmorOrShieldOrJewelry();

                                    if (item is BaseArmor armor)
                                    {
                                        BaseRunicTool.ApplyAttributesTo(armor, 2, 20, 30);
                                    }
                                    else if (item is BaseJewel jewel)
                                    {
                                        BaseRunicTool.ApplyAttributesTo(jewel, 2, 20, 30);
                                    }

                                    cont.DropItem(item);
                                }

                                if (player.BAC > 0)
                                {
                                    cont.DropItem(new HangoverCure());
                                }

                                if (player.PlaceInBackpack(cont))
                                {
                                    bool gainedPath = false;

                                    if (VirtueHelper.Award(player, VirtueName.Sacrifice, 250, ref gainedPath)) // TODO: Check amount on OSI.
                                    {
                                        player.SendLocalizedMessage(1054160);                                  // You have gained in sacrifice.
                                    }
                                    PlaySound(0x253);
                                    PlaySound(0x20);
                                    obj.Complete();
                                }
                                else
                                {
                                    cont.Delete();
                                    player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                QuestSystem newQuest        = new WitchApprenticeQuest(player);
                bool        inRestartPeriod = false;

                if (qs != null)
                {
                    newQuest.AddConversation(new DontOfferConversation());
                }
                else if (QuestSystem.CanOfferQuest(player, typeof(WitchApprenticeQuest), out inRestartPeriod))
                {
                    PlaySound(0x20);
                    PlaySound(0x206);
                    newQuest.SendOffer();
                }
                else if (inRestartPeriod)
                {
                    PlaySound(0x259);
                    PlaySound(0x206);
                    newQuest.AddConversation(new RecentlyFinishedConversation());
                }
            }
        }
コード例 #60
0
        public Item Mutate(Mobile from, int luckChance, Item item)
        {
            if (item != null)
            {
                /*if ( item is BaseWeapon && 1 > Utility.Random( 100 ) ) //No FireHorns
                 * {
                 *      item.Delete();
                 *      item = new FireHorn();
                 *      return item;
                 * }*/

                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                {
                    if (Core.AOS)
                    {
                        int bonusProps = GetBonusProperties();
                        int min        = m_MinIntensity;
                        int max        = m_MaxIntensity;

                        if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance))
                        {
                            ++bonusProps;
                        }

                        int props = 1 + bonusProps;

                        // Make sure we're not spawning items with 6 properties.
                        if (props > m_MaxProps)
                        {
                            props = m_MaxProps;
                        }

                        if (item is BaseWeapon)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseArmor)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseJewel)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseHat)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                    }
                    else                     // not aos
                    {
                        if (item is BaseWeapon)
                        {
                            BaseWeapon weapon = (BaseWeapon)item;

                            if (80 > Utility.Random(100))
                            {
                                weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
                            }

                            if (60 > Utility.Random(100))
                            {
                                weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus();
                            }

                            if (40 > Utility.Random(100))
                            {
                                weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus();
                            }

                            if (5 > Utility.Random(100))
                            {
                                weapon.Slayer = SlayerName.Silver;
                            }
                            //No slayer weapons

                            /*if ( from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random( 100 ) )
                             *      weapon.Slayer = SlayerGroup.GetLootSlayerType( from.GetType() );*/
                        }
                        else if (item is BaseArmor)
                        {
                            BaseArmor armor = (BaseArmor)item;

                            if (80 > Utility.Random(100))
                            {
                                armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
                            }

                            if (40 > Utility.Random(100))
                            {
                                armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
                            }
                        }
                    }
                }
                else if (item is BaseInstrument)
                {
                    SlayerName slayer = SlayerName.None;

                    if (Core.AOS)
                    {
                        slayer = BaseRunicTool.GetRandomSlayer();
                    }
                    else
                    {
                        slayer = SlayerGroup.GetLootSlayerType(from.GetType());
                    }

                    if (slayer == SlayerName.None)
                    {
                        item.Delete();
                        return(null);
                    }

                    BaseInstrument instr = (BaseInstrument)item;

                    instr.Quality = InstrumentQuality.Regular;
                    instr.Slayer  = slayer;
                }

                if (item.Stackable)
                {
                    item.Amount = m_Quantity.Roll();
                }
            }

            return(item);
        }