ITLongwell / mondains-legacy

Automatically exported from code.google.com/p/mondains-legacy
0 stars 0 forks source link

Dryad Allure Bug #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Dryad Allure allows the caster to charm humanoids (not player 
characters) and command them to do her bidding. In the script package ( 
SVN 15) I do not see restrictions in this area.
2.
3.

What is the expected output? What do you see instead?
using System;

using Server.Targeting;
using Server.Mobiles;
using Server.Factions;

namespace Server.Spells.Spellweaving
{
    public class DryadAllureSpell : ArcanistSpell
    {
        private static SpellInfo m_Info = new SpellInfo(
                "Dryad Allure", "Rathril",
                -1
            );

        public override double RequiredSkill { get { return 52.0; } }
        public override int RequiredMana { get { return 40; } }
        public override TimeSpan CastDelayBase { get { return 
TimeSpan.FromSeconds(3); } }

        public DryadAllureSpell( Mobile caster, Item scroll ) : base( 
caster, scroll, m_Info )
        {
        }

        public override void OnCast()
        {
            Caster.Target = new InternalTarget( this );
        }

        public void Target( Mobile m )
        {

            if( !Caster.CanSee( m.Location ) || !Caster.InLOS( 
m ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // 
Target can not be seen.
            }
            else if( ! CanBeAllured(m))
            {
                Caster.SendLocalizedMessage( 1074379 ); // 
You cannot charm that!
            }
            else
            {
                BaseCreature bc = (BaseCreature)m;

                if( bc.IsParagon  ) //TODO: Correct 
formula for paragons?
                {
                    Caster.SendLocalizedMessage( 
1074379 ); // You cannot charm that!
                }
                else if( bc.Allured || bc.Controlled || 
bc.Summoned )
                {
                    Caster.SendLocalizedMessage( 
1074380 ); // This humanoid is already controlled by someone else.
                }
                else if( CheckSequence() )
                {

                    double skill = Caster.Skills
[SkillName.Spellweaving].Value;

                    double chance = ( skill / 240 ) + 
( FocusLevel / 50 ); // Floor( Skill / 240 ) + ( FocusLevel / 50 )

                    if( chance > Utility.RandomDouble
() )
                    {
                        if( Allure( Caster, bc ) )
                        {

    Caster.SendLocalizedMessage( 1074377 ); // You allure the humanoid 
to follow and protect you.
                        }
                    }
                    else
                    {
                        bc.PlaySound( 0x5C5 );
                        bc.ControlTarget = Caster;
                        bc.ControlOrder = 
OrderType.Attack;
                        bc.Combatant = Caster;

                        Caster.SendLocalizedMessage
( 1074378 ); // The humanoid becomes enraged by your charming attempt and 
attacks you.
                    }
                }
            }

            FinishSequence();

        }

        public static bool CanBeAllured(Mobile m) 
        {
            //!m.Body.IsHuman  
            if(m.Player ) return false; 
            else if (!( m is BaseCreature )) return false; 
            else if (m is BaseFactionGuard) return false; 
            else if ( m is BaseChampion ) return false; 
            else if ( m.Blessed ) return false; 
            else if (m is BaseVendor) return false; 
            else if (m.Body.IsHuman) return true; 
            else if (m is ArcticOgreLord) return true; 
            else if (m is Ettin) return true; 
            else if (m is Cyclops) return true; 
            else if (m is EvilMage) return true; 
            else if (m is EvilMageLord) return true; 
            else if (m is FrostTroll) return true; 
            else if (m is MeerCaptain) return true;
            else if (m is MeerEternal) return true;  
            else if (m is MeerMage) return true; 
            else if (m is MeerWarrior) return true; 
            else if (m is Ogre) return true; 
            else if (m is OgreLord) return true; 
            else if (m is Orc) return true; 
            else if (m is OrcBomber) return true; 
            else if (m is OrcBrute) return true; 
            else if (m is OrcCaptain) return true; 
            //else if (m is OrcScout) return true; 
            else if (m is OrcishLord) return true; 
            else if (m is OrcishMage) return true; 
            else if (m is Ratman) return true; 
            else if (m is RatmanArcher) return true; 
            else if (m is RatmanMage) return true; 
            else if (m is SavageRider) return true; 
            else if (m is SavageShaman) return true; 
            else if (m is Savage) return true; 
            else if (m is Titan) return true; 
            else if (m is Troll) return true; 
            else return false;              

        }

        public static bool Allure( Mobile allurer, BaseCreature 
bc )
        {
            if( bc.Allured || bc.Controlled || 
bc.Summoned ) // Sanity.
            {
                allurer.SendLocalizedMessage( 
1074380 ); // This humanoid is already controlled by someone else.
                return false;
            }

            int c = bc.ControlSlots;

            bc.ControlSlots = 3;

            if( bc.SetControlMaster( allurer ) )
            {
                bc.PlaySound( 0x5C4 );
                bc.Allured = true;
            }
            else
            {
                bc.ControlSlots = c;
                return false;
            }

            return true;
        }

        public class InternalTarget : Target
        {
            private DryadAllureSpell m_Owner;

            public InternalTarget( DryadAllureSpell owner ) : 
base( 12, false, TargetFlags.None )
            {
                m_Owner = owner;
            }

            protected override void OnTarget( Mobile m, object 
o )
            {
                if( o is Mobile )
                {
                    m_Owner.Target( (Mobile)o );
                }
                else
                {
                    m.SendLocalizedMessage( 
1074379 ); // You cannot charm that!
                }
            }

            protected override void OnTargetFinish( Mobile m )
            {
                m_Owner.FinishSequence();
            }
        }
    }
}

What version of the product are you using? On what operating system?
SVN 15 , Windows XP

Original issue reported on code.google.com by melan...@gmail.com on 5 Aug 2008 at 4:10

GoogleCodeExporter commented 8 years ago
Here is my spellweaving folder with all spells. Hope help you in your work.

Original comment by melan...@gmail.com on 5 Aug 2008 at 4:20

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I don't see anything wrong with MalGanis version now the one you got with the 
public static bool CanBeAllured(Mobile m) 
        {
not good at all cause you got a part there Is.Human true an you cant Allured 
Human .
So MalGanis one i don't see any bugs.

Original comment by uorevolu...@gmail.com on 7 Aug 2008 at 3:23

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Any specific mobile you can allure thats not on the list, because i tested and 
you 
cant allure vendors, brigands...

Original comment by gje...@gmail.com on 8 Aug 2008 at 4:18

GoogleCodeExporter commented 8 years ago
I was told one of our players STABLED an allured creature, should you be able 
to do 
that? I was pretty sure you shouldn't be able to.
If they did and Ill go with them to get it out of the stable Ill also let you 
know 
what it was (distro or custom)
**Will confirm after work,the player is offline**

Original comment by ShazzySh...@gmail.com on 11 Aug 2008 at 12:06

GoogleCodeExporter commented 8 years ago
Allured creatures can't be stabled or bonded. Fixed in SVN 18.

Original comment by gje...@gmail.com on 11 Aug 2008 at 8:26