-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseCreature.cs
More file actions
9661 lines (8148 loc) · 290 KB
/
BaseCreature.cs
File metadata and controls
9661 lines (8148 loc) · 290 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Collections;
using Server.Regions;
using Server.Targeting;
using Server.Network;
using Server.Multis;
using Server.Spells;
using Server.Misc;
using Server.Items;
using Server.Gumps;
using Server.ContextMenus;
using Server.Engines.PartySystem;
using Server.Spells.Bushido;
using Server.Spells.Necromancy;
using Server.Spells.Elementalism;
using System.Text;
using Server;
using System.IO;
namespace Server.Mobiles
{
#region Enums
/// <summary>
/// Summary description for MobileAI.
/// </summary>
///
public enum FightMode
{
None, // Never focus on others
Aggressor, // Only attack aggressors
Strongest, // Attack the strongest
Weakest, // Attack the weakest
Closest, // Attack the closest
Evil, // Only attack aggressor -or- negative karma
Good, // Only attack aggressor -or- positive karma
CharmMonster,
CharmAnimal
}
public enum OrderType
{
None, //When no order, let's roam
Come, //"(All/Name) come" Summons all or one pet to your location.
Drop, //"(Name) drop" Drops its loot to the ground (if it carries any).
Follow, //"(Name) follow" Follows targeted being.
//"(All/Name) follow me" Makes all or one pet follow you.
Friend, //"(Name) friend" Allows targeted player to confirm resurrection.
Unfriend, // Remove a friend
Guard, //"(Name) guard" Makes the specified pet guard you. Pets can only guard their owner.
//"(All/Name) guard me" Makes all or one pet guard you.
Attack, //"(All/Name) kill",
//"(All/Name) attack" All or the specified pet(s) currently under your control attack the target.
Patrol, //"(Name) patrol" Roves between two or more guarded targets.
Release, //"(Name) release" Releases pet back into the wild (removes "tame" status).
Stay, //"(All/Name) stay" All or the specified pet(s) will stop and stay in current spot.
Stop, //"(All/Name) stop Cancels any current orders to attack, guard or follow.
Transfer //"(Name) transfer" Transfers complete ownership to targeted player.
}
[Flags]
public enum FoodType
{
None = 0x0000,
Meat = 0x0001,
FruitsAndVegies = 0x0002,
GrainsAndHay = 0x0004,
Fish = 0x0008,
Eggs = 0x0010,
Gold = 0x0020,
Fire = 0x0040,
Gems = 0x0080,
Nox = 0x0100,
Sea = 0x0200,
Moon = 0x0400
}
[Flags]
public enum PackInstinct
{
None = 0x0000,
Canine = 0x0001,
Ostard = 0x0002,
Feline = 0x0004,
Arachnid = 0x0008,
Daemon = 0x0010,
Bear = 0x0020,
Equine = 0x0040,
Bull = 0x0080
}
public enum MeatType
{
Ribs,
Bird,
LambLeg,
Fish,
Pigs
}
public enum ClothType
{
Fabric,
Furry,
Wooly,
Silk,
Haunted,
Arctic,
Pyre,
Venomous,
Mysterious,
Vile,
Divine,
Fiendish
}
public enum ScaleType
{
Red,
Yellow,
Black,
Green,
White,
Blue,
Dinosaur,
Metallic,
Brazen,
Umber,
Violet,
Platinum,
Cadalyte,
SciFi
}
public enum SkeletalType
{
Brittle,
Drow,
Orc,
Reptile,
Ogre,
Troll,
Gargoyle,
Minotaur,
Lycan,
Shark,
Colossal,
Mystical,
Vampire,
Lich,
Sphinx,
Devil,
Draco,
Xeno,
All,
SciFi
}
public enum HideType
{
Regular,
Spined,
Horned,
Barbed,
Necrotic,
Volcanic,
Frozen,
Goliath,
Draconic,
Hellish,
Dinosaur,
Alien
}
public enum SkinType
{
Demon,
Dragon,
Nightmare,
Snake,
Troll,
Unicorn,
Icy,
Lava,
Seaweed,
Dead
}
public enum GraniteType
{
Iron,
DullCopper,
ShadowIron,
Copper,
Bronze,
Gold,
Agapite,
Verite,
Valorite,
Nepturite,
Obsidian,
Mithril,
Xormite,
Dwarven,
Steel,
Brass
}
public enum RockType
{
Iron,
DullCopper,
ShadowIron,
Copper,
Bronze,
Gold,
Agapite,
Verite,
Valorite,
Nepturite,
Obsidian,
Steel,
Brass,
Mithril,
Xormite,
Dwarven,
Amethyst,
Emerald,
Garnet,
Ice,
Jade,
Marble,
Onyx,
Quartz,
Ruby,
Sapphire,
Silver,
Spinel,
StarRuby,
Topaz,
Caddellite,
Crystals,
Stones,
SciFi
}
public enum MetalType
{
Iron,
DullCopper,
ShadowIron,
Copper,
Bronze,
Gold,
Agapite,
Verite,
Valorite,
Nepturite,
Obsidian,
Steel,
Brass,
Mithril,
Xormite,
Dwarven,
SciFi
}
public enum WoodType
{
Regular,
Ash,
Cherry,
Ebony,
GoldenOak,
Hickory,
Mahogany,
Oak,
Pine,
Ghost,
Rosewood,
Walnut,
Petrified,
Driftwood,
Elven
}
#endregion
public class DamageStore : IComparable
{
public Mobile m_Mobile;
public int m_Damage;
public bool m_HasRight;
public DamageStore( Mobile m, int damage )
{
m_Mobile = m;
m_Damage = damage;
}
public int CompareTo( object obj )
{
DamageStore ds = (DamageStore)obj;
return ds.m_Damage - m_Damage;
}
}
[AttributeUsage( AttributeTargets.Class )]
public class FriendlyNameAttribute : Attribute
{
//future use: Talisman 'Protection/Bonus vs. Specific Creature
private TextDefinition m_FriendlyName;
public TextDefinition FriendlyName
{
get
{
return m_FriendlyName;
}
}
public FriendlyNameAttribute( TextDefinition friendlyName )
{
m_FriendlyName = friendlyName;
}
public static TextDefinition GetFriendlyNameFor( Type t )
{
if( t.IsDefined( typeof( FriendlyNameAttribute ), false ) )
{
object[] objs = t.GetCustomAttributes( typeof( FriendlyNameAttribute ), false );
if( objs != null && objs.Length > 0 )
{
FriendlyNameAttribute friendly = objs[0] as FriendlyNameAttribute;
return friendly.FriendlyName;
}
}
return t.Name;
}
}
public class BaseCreature : Mobile
{
public const int MaxLoyalty = 100;
#region Var declarations
private BaseAI m_AI; // THE AI
private AIType m_CurrentAI; // The current AI
private AIType m_DefaultAI; // The default AI
private Mobile m_FocusMob; // Use focus mob instead of combatant, maybe we don't whan to fight
private FightMode m_FightMode; // The style the mob uses
private int m_iRangePerception; // The view area
private int m_iRangeFight; // The fight distance
private bool m_bDebugAI; // Show debug AI messages
private int m_iTeam; // Monster Team
private double m_dActiveSpeed; // Timer speed when active
private double m_dPassiveSpeed; // Timer speed when not active
private double m_dCurrentSpeed; // The current speed, lets say it could be changed by something;
private Point3D m_pHome; // The home position of the creature, used by some AI
private int m_iRangeHome = 10; // The home range of the creature
List<Type> m_arSpellAttack; // List of attack spell/power
List<Type> m_arSpellDefense; // List of defensive spell/power
private bool m_bControlled; // Is controlled
private Mobile m_ControlMaster; // My master
private Mobile m_ControlTarget; // My target mobile
private Point3D m_ControlDest; // My target destination (patrol)
private OrderType m_ControlOrder; // My order
private int m_Loyalty;
private double m_dMinTameSkill;
private bool m_bTamable;
private bool m_bSummoned = false;
private DateTime m_SummonEnd;
private int m_iControlSlots = 1;
private bool m_bBardProvoked = false;
private bool m_bBardPacified = false;
private Mobile m_bBardMaster = null;
private Mobile m_bBardTarget = null;
private DateTime m_timeBardEnd;
private WayPoint m_CurrentWayPoint = null;
private IPoint2D m_TargetLocation = null;
private Mobile m_SummonMaster;
private int m_HitsMax = -1;
private int m_StamMax = -1;
private int m_ManaMax = -1;
private int m_DamageMin = -1;
private int m_DamageMax = -1;
private int m_PhysicalResistance, m_PhysicalDamage = 100;
private int m_FireResistance, m_FireDamage;
private int m_ColdResistance, m_ColdDamage;
private int m_PoisonResistance, m_PoisonDamage;
private int m_EnergyResistance, m_EnergyDamage;
private int m_ChaosDamage;
private int m_DirectDamage;
private List<Mobile> m_Owners;
private List<Mobile> m_Friends;
private bool m_IsStabled;
private bool m_HasGeneratedLoot; // have we generated our loot yet?
private bool m_Paragon;
private bool m_IsTempEnemy;
private int m_Coins;
private string m_CoinType;
private int m_SpawnerID;
private bool m_Swimmer;
private bool m_NoWalker;
private int m_HitsBeforeMod;
private SlayerName m_Slayer;
private SlayerName m_Slayer2;
#endregion
private CraftResource m_Resource;
[CommandProperty(AccessLevel.Owner)]
public CraftResource Resource { get { return m_Resource; } set { m_Resource = value; InvalidateProperties(); } }
public virtual InhumanSpeech SpeechType{ get{ return null; } }
public virtual string TalkGumpTitle{ get{ return null; } }
public virtual string TalkGumpSubject{ get{ return null; } }
[CommandProperty( AccessLevel.GameMaster )]
public SlayerName Slayer
{
get{ return m_Slayer; }
set{ m_Slayer = value; InvalidateProperties(); }
}
[CommandProperty( AccessLevel.GameMaster )]
public SlayerName Slayer2
{
get { return m_Slayer2; }
set { m_Slayer2 = value; InvalidateProperties(); }
}
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
public bool IsStabled
{
get{ return m_IsStabled; }
set
{
m_IsStabled = value;
if ( m_IsStabled )
StopDeleteTimer();
}
}
[CommandProperty( AccessLevel.GameMaster )]
public bool IsTempEnemy
{
get{ return m_IsTempEnemy; }
set{ m_IsTempEnemy = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int HitsBeforeMod
{
get{ return m_HitsBeforeMod; }
set{ m_HitsBeforeMod = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int Coins
{
get{ return m_Coins; }
set{ m_Coins = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public string CoinType
{
get{ return m_CoinType; }
set{ m_CoinType = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int SpawnerID
{
get{ return m_SpawnerID; }
set{ m_SpawnerID = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool Swimmer
{
get{ return m_Swimmer; }
set{ m_Swimmer = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool NoWalker
{
get{ return m_NoWalker; }
set{ m_NoWalker = value; }
}
protected DateTime SummonEnd
{
get { return m_SummonEnd; }
set { m_SummonEnd = value; }
}
#region Bonding
public const bool BondingEnabled = true;
public virtual bool IsNecromancer { get { return ( Skills[ SkillName.Necromancy ].Value > 50 ); } }
public virtual bool IsBondable{ get{ return ( BondingEnabled && !Summoned ); } }
public virtual TimeSpan BondingDelay{ get{ return TimeSpan.FromDays( MyServerSettings.BondDays() ); } }
public virtual TimeSpan BondingAbandonDelay{ get{ return TimeSpan.FromDays( 1.0 ); } }
public override bool CanRegenHits{ get{ return !m_IsDeadPet && base.CanRegenHits; } }
public override bool CanRegenStam{ get{ return !m_IsDeadPet && base.CanRegenStam; } }
public override bool CanRegenMana{ get{ return !m_IsDeadPet && base.CanRegenMana; } }
public override bool IsDeadBondedPet{ get{ return m_IsDeadPet; } }
private bool m_IsBonded;
private bool m_IsDeadPet;
private DateTime m_BondingBegin;
private DateTime m_OwnerAbandonTime;
[CommandProperty( AccessLevel.GameMaster )]
public Mobile LastOwner
{
get
{
if ( m_Owners == null || m_Owners.Count == 0 )
return null;
return m_Owners[m_Owners.Count - 1];
}
}
[CommandProperty( AccessLevel.GameMaster )]
public bool IsBonded
{
get{ return m_IsBonded; }
set{ m_IsBonded = value; InvalidateProperties(); }
}
public bool IsDeadPet
{
get{ return m_IsDeadPet; }
set{ m_IsDeadPet = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public DateTime BondingBegin
{
get{ return m_BondingBegin; }
set{ m_BondingBegin = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public DateTime OwnerAbandonTime
{
get{ return m_OwnerAbandonTime; }
set{ m_OwnerAbandonTime = value; }
}
#endregion
#region Delete Previously Tamed Timer
private DeleteTimer m_DeleteTimer;
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan DeleteTimeLeft
{
get
{
if ( m_DeleteTimer != null && m_DeleteTimer.Running )
return m_DeleteTimer.Next - DateTime.Now;
return TimeSpan.Zero;
}
}
private class DeleteTimer : Timer
{
private Mobile m;
public DeleteTimer( Mobile creature, TimeSpan delay ) : base( delay )
{
m = creature;
Priority = TimerPriority.OneMinute;
}
protected override void OnTick()
{
m.Delete();
}
}
public void BeginDeleteTimer()
{
if ( !Summoned && !Deleted && !IsStabled )
{
StopDeleteTimer();
m_DeleteTimer = new DeleteTimer( this, TimeSpan.FromDays( 3.0 ) );
m_DeleteTimer.Start();
}
}
public void StopDeleteTimer()
{
if ( m_DeleteTimer != null )
{
m_DeleteTimer.Stop();
m_DeleteTimer = null;
}
}
#endregion
public virtual double WeaponAbilityChance{ get{ return 0.4; } }
public virtual WeaponAbility GetWeaponAbility()
{
return null;
}
#region Elemental Resistance/Damage
public override int BasePhysicalResistance{ get{ return m_PhysicalResistance; } }
public override int BaseFireResistance{ get{ return m_FireResistance; } }
public override int BaseColdResistance{ get{ return m_ColdResistance; } }
public override int BasePoisonResistance{ get{ return m_PoisonResistance; } }
public override int BaseEnergyResistance{ get{ return m_EnergyResistance; } }
[CommandProperty( AccessLevel.GameMaster )]
public int PhysicalResistanceSeed{ get{ return m_PhysicalResistance; } set{ m_PhysicalResistance = value; UpdateResistances(); } }
[CommandProperty( AccessLevel.GameMaster )]
public int FireResistSeed{ get{ return m_FireResistance; } set{ m_FireResistance = value; UpdateResistances(); } }
[CommandProperty( AccessLevel.GameMaster )]
public int ColdResistSeed{ get{ return m_ColdResistance; } set{ m_ColdResistance = value; UpdateResistances(); } }
[CommandProperty( AccessLevel.GameMaster )]
public int PoisonResistSeed{ get{ return m_PoisonResistance; } set{ m_PoisonResistance = value; UpdateResistances(); } }
[CommandProperty( AccessLevel.GameMaster )]
public int EnergyResistSeed{ get{ return m_EnergyResistance; } set{ m_EnergyResistance = value; UpdateResistances(); } }
[CommandProperty( AccessLevel.GameMaster )]
public int PhysicalDamage{ get{ return m_PhysicalDamage; } set{ m_PhysicalDamage = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public int FireDamage{ get{ return m_FireDamage; } set{ m_FireDamage = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public int ColdDamage{ get{ return m_ColdDamage; } set{ m_ColdDamage = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public int PoisonDamage{ get{ return m_PoisonDamage; } set{ m_PoisonDamage = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public int EnergyDamage{ get{ return m_EnergyDamage; } set{ m_EnergyDamage = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public int ChaosDamage{ get{ return m_ChaosDamage; } set{ m_ChaosDamage = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public int DirectDamage{ get{ return m_DirectDamage; } set{ m_DirectDamage = value; } }
#endregion
[CommandProperty( AccessLevel.GameMaster )]
public bool IsParagon
{
get{ return m_Paragon; }
set
{
if ( m_Paragon == value )
return;
else if ( value )
Paragon.Convert( this );
else
Paragon.UnConvert( this );
m_Paragon = value;
InvalidateProperties();
}
}
public virtual FoodType FavoriteFood{ get{ return FoodType.Meat; } }
public virtual PackInstinct PackInstinct{ get{ return PackInstinct.None; } }
public List<Mobile> Owners { get { return m_Owners; } }
public virtual bool AllowMaleTamer{ get{ return true; } }
public virtual bool AllowFemaleTamer{ get{ return true; } }
public virtual bool SubdueBeforeTame{ get{ return false; } }
public virtual bool StatLossAfterTame{ get{ return SubdueBeforeTame; } }
public virtual bool ReduceSpeedWithDamage{ get{ return true; } }
public virtual bool IsSubdued{ get{ return SubdueBeforeTame && ( Hits < ( HitsMax / 10 ) ); } }
public virtual bool Commandable{ get{ return true; } }
public virtual Poison HitPoison{ get{ return null; } }
public virtual double HitPoisonChance{ get{ return 0.5; } }
public virtual Poison PoisonImmune{ get{ return null; } }
public virtual bool BardImmune{ get{ return false; } }
public virtual bool Unprovokable{ get{ return BardImmune || m_IsDeadPet; } }
public virtual bool Uncalmable{ get{ return BardImmune || m_IsDeadPet; } }
public virtual bool AreaPeaceImmune { get { return BardImmune || m_IsDeadPet; } }
public virtual bool BleedImmune{ get{ return false; } }
public virtual double BonusPetDamageScalar{ get{ return 1.0; } }
public virtual bool DeathAdderCharmable{ get{ return false; } }
//TODO: Find the pub 31 tweaks to the DispelDifficulty and apply them of course.
public virtual double DispelDifficulty{ get{ return 0.0; } } // at this skill level we dispel 50% chance
public virtual double DispelFocus{ get{ return 20.0; } } // at difficulty - focus we have 0%, at difficulty + focus we have 100%
public virtual bool DisplayWeight{ get{ return Backpack is StrongBackpack; } }
#region Breath ability, like dragon fire breath
private DateTime m_NextBreathTime;
// Must be overriden in subclass to enable
public virtual bool HasBreath{ get{ return false; } }
// Base damage given is: CurrentHitPoints * BreathDamageScalar
public virtual double BreathDamageScalar{ get{ return 0.20; } }
// Min/max seconds until next breath
public virtual double BreathMinDelay{ get{ return 10.0; } }
public virtual double BreathMaxDelay{ get{ return 15.0; } }
// Creature stops moving for 1.0 seconds while breathing
public virtual double BreathStallTime{ get{ return 1.0; } }
// Effect is sent 1.3 seconds after BreathAngerSound and BreathAngerAnimation is played
public virtual double BreathEffectDelay{ get{ return 1.3; } }
// Damage is given 1.0 seconds after effect is sent
public virtual double BreathDamageDelay{ get{ return 1.0; } }
public virtual int BreathRange{ get{ return RangePerception; } }
// Damage types
public virtual int BreathPhysicalDamage{ get{ return 0; } }
public virtual int BreathFireDamage{ get{ return 100; } }
public virtual int BreathColdDamage{ get{ return 0; } }
public virtual int BreathPoisonDamage{ get{ return 0; } }
public virtual int BreathEnergyDamage{ get{ return 0; } }
// Is immune to breath damages
public virtual bool BreathImmune{ get{ return false; } }
// Effect details and sound
public virtual int BreathEffectItemID{ get{ return 0x36D4; } }
public virtual int BreathEffectSpeed{ get{ return 5; } }
public virtual int BreathEffectDuration{ get{ return 0; } }
public virtual bool BreathEffectExplodes{ get{ return false; } }
public virtual bool BreathEffectFixedDir{ get{ return false; } }
public virtual int BreathEffectHue{ get{ return 0; } }
public virtual int BreathEffectRenderMode{ get{ return 0; } }
public virtual int BreathEffectSound{ get{ return 0x227; } }
// Anger sound/animations
public virtual int BreathAngerSound{ get{ return GetAngerSound(); } }
public virtual int BreathAngerAnimation{ get{ return 12; } }
public virtual void BreathStart( Mobile target )
{
BreathStallMovement();
BreathPlayAngerSound();
BreathPlayAngerAnimation();
this.Direction = this.GetDirectionTo( target );
Timer.DelayCall( TimeSpan.FromSeconds( BreathEffectDelay ), new TimerStateCallback( BreathEffect_Callback ), target );
}
public virtual void BreathStallMovement()
{
if ( m_AI != null )
m_AI.NextMove = DateTime.Now + TimeSpan.FromSeconds( BreathStallTime );
}
public virtual void BreathPlayAngerSound()
{
PlaySound( BreathAngerSound );
}
public virtual void BreathPlayAngerAnimation()
{
Animate( BreathAngerAnimation, 5, 1, true, false, 0 );
}
public virtual void BreathEffect_Callback( object state )
{
Mobile target = (Mobile)state;
if ( !target.Alive || !CanBeHarmful( target ) )
return;
BreathPlayEffectSound();
if ( BreathEffectItemID > 0 ){ BreathPlayEffect( target ); }
Timer.DelayCall( TimeSpan.FromSeconds( BreathDamageDelay ), new TimerStateCallback( BreathDamage_Callback ), target );
}
public virtual void BreathPlayEffectSound()
{
PlaySound( BreathEffectSound );
}
public virtual void BreathPlayEffect( Mobile target )
{
Effects.SendMovingEffect( this, target, BreathEffectItemID,
BreathEffectSpeed, BreathEffectDuration, BreathEffectFixedDir,
BreathEffectExplodes, BreathEffectHue, BreathEffectRenderMode );
}
public virtual void BreathDamage_Callback( object state )
{
Mobile target = (Mobile)state;
if ( target is BaseCreature && ((BaseCreature)target).BreathImmune )
return;
if ( CanBeHarmful( target ) )
{
DoHarmful( target );
BreathDealDamage( target, 0 );
}
}
public virtual void BreathDealDamage( Mobile target, int form )
{
if( Evasion.CheckSpellEvasion( target ) )
return;
DoFinalBreathAttack( target, form, true );
}
public void DoFinalBreathAttack( Mobile target, int form, bool cycle )
{
int physDamage = BreathPhysicalDamage;
int fireDamage = BreathFireDamage;
int coldDamage = BreathColdDamage;
int poisDamage = BreathPoisonDamage;
int nrgyDamage = BreathEnergyDamage;
int BreathDistance = 0;
Point3D blast1 = new Point3D( ( target.X ), ( target.Y ), target.Z );
Point3D blast2 = new Point3D( ( target.X-1 ), ( target.Y ), target.Z );
Point3D blast3 = new Point3D( ( target.X+1 ), ( target.Y ), target.Z );
Point3D blast4 = new Point3D( ( target.X ), ( target.Y-1 ), target.Z );
Point3D blast5 = new Point3D( ( target.X ), ( target.Y+1 ), target.Z );
Point3D blast1z = new Point3D( ( target.X ), ( target.Y ), target.Z+10 );
Point3D blast2z = new Point3D( ( target.X-1 ), ( target.Y ), target.Z+10 );
Point3D blast3z = new Point3D( ( target.X+1 ), ( target.Y ), target.Z+10 );
Point3D blast4z = new Point3D( ( target.X ), ( target.Y-1 ), target.Z+10 );
Point3D blast5z = new Point3D( ( target.X ), ( target.Y+1 ), target.Z+10 );
Point3D blast1w = new Point3D( ( target.X ), ( target.Y ), target.Z );
Point3D blast2w = new Point3D( ( target.X-2 ), ( target.Y ), target.Z );
Point3D blast3w = new Point3D( ( target.X+2 ), ( target.Y ), target.Z );
Point3D blast4w = new Point3D( ( target.X ), ( target.Y-2 ), target.Z );
Point3D blast5w = new Point3D( ( target.X ), ( target.Y+2 ), target.Z );
AOS.Damage( target, this, BreathComputeDamage(), physDamage, fireDamage, coldDamage, poisDamage, nrgyDamage );
if ( form == 1 ) // CRYSTAL DRAGONS -----------------------------------------------------------------------------------------------------
{
int bColor = Utility.RandomList( 0x48D, 0x48E, 0x48F, 0x490, 0x491 );
Effects.SendLocationEffect( blast1, target.Map, 0x3709, 30, 10, bColor, 0 );
Effects.SendLocationEffect( blast2, target.Map, 0x3709, 30, 10, bColor, 0 );
Effects.SendLocationEffect( blast3, target.Map, 0x3709, 30, 10, bColor, 0 );
Effects.SendLocationEffect( blast4, target.Map, 0x3709, 30, 10, bColor, 0 );
Effects.SendLocationEffect( blast5, target.Map, 0x3709, 30, 10, bColor, 0 );
target.PlaySound( 0x208 );
BreathDistance = 3;
}
else if ( form == 2 ) // POTIONS THROWN -------------------------------------------------------------------------------------------------
{
if ( BreathEffectHue == 0x488 )
{
Effects.SendLocationEffect( blast1, target.Map, 0x3709, 30, 10 );
target.PlaySound( 0x208 );
target.PlaySound( 0x38D );
}
else if ( BreathEffectHue == 0xB92 )
{
Effects.SendLocationParticles( EffectItem.Create( blast1, target.Map, EffectItem.DefaultDuration ), 0x36B0, 1, 14, 63, 7, 9915, 0 );
Effects.PlaySound( target.Location, target.Map, 0x229 );
if ( !(Server.Items.HiddenTrap.SavingThrow( target, "Poison", false, null )) )
{
switch( Utility.RandomMinMax( 1, 2 ) )
{
case 1: target.ApplyPoison( target, Poison.Lesser ); break;
case 2: target.ApplyPoison( target, Poison.Regular ); break;
}
}
target.PlaySound( 0x38D );
}
else if ( form == 0x5B5 )
{
Point3D vortex = new Point3D( ( target.X+1 ), ( target.Y+1 ), target.Z );
Effects.SendLocationEffect( vortex, target.Map, 0x37CC, 30, 10, 0x481, 0 );
target.PlaySound( 0x10B );
target.PlaySound( 0x38D );
}
else
{
target.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Head );
target.PlaySound( 0x307 );
}
this.YellHue = Utility.RandomMinMax( 0, 3 ); // THIS IS USED TO RANDOMIZE POTION TYPES
}
else if ( form == 3 ) // DAGGERS OR STARS THROWN ----------------------------------------------------------------------------------------
{
if ( target is PlayerMobile && Server.Items.BaseRace.IsBleeder( target ) )
{
Server.Misc.IntelligentAction.CryOut( target );
Blood blood = new Blood(); blood.MoveToWorld( blast2, this.Map );
blood = new Blood(); blood.MoveToWorld( blast3, this.Map );
blood = new Blood(); blood.MoveToWorld( blast4, this.Map );
blood = new Blood(); blood.MoveToWorld( blast5, this.Map );
}
if ( BreathEffectItemID == 0x406C ) // ASSASSIN STAR
{
if ( !(Server.Items.HiddenTrap.SavingThrow( target, "Poison", false, null )) )
{
switch( Utility.RandomMinMax( 1, 2 ) )
{
case 1: target.ApplyPoison( target, Poison.Lesser ); break;
case 2: target.ApplyPoison( target, Poison.Regular ); break;
}
}
}
}
else if ( form == 4 ) // DINOSAUR ROAR --------------------------------------------------------------------------------------------------
{
target.SendMessage( "You are hit by the force of the mighty roar!" );
target.PlaySound( 0x63F );
BreathDistance = 5;
}
else if ( form == 5 ) // MANTICORE ------------------------------------------------------------------------------------------------------
{
target.SendMessage( "You are hit by a manticore thorn!" );
if ( !(Server.Items.HiddenTrap.SavingThrow( target, "Poison", false, null )) )
{
target.ApplyPoison( target, Poison.Lethal );
}
Server.Misc.IntelligentAction.CryOut( target );
}
else if ( form == 6 ) // SPIDERS --------------------------------------------------------------------------------------------------------
{
Effects.SendLocationEffect( blast1, target.Map, 0x10D3, 30, 10, 0, 0 );
target.PlaySound( 0x62D );
double webbed = ((double)(this.Fame/200)) > MySettings.S_paralyzeDuration ? MySettings.S_paralyzeDuration : ((double)(this.Fame/200));
target.Paralyze( TimeSpan.FromSeconds( webbed ) );
}
else if ( form == 7 ) // GIANT STONES AND LOGS ------------------------------------------------------------------------------------------
{
Effects.SendLocationEffect( blast1, target.Map, 0x36B0, 30, 10, 0x837, 0 );
target.PlaySound( 0x664 );
BreathDistance = 2;
}
else if ( form == 8 ) // LARGE SAND BREATH ----------------------------------------------------------------------------------------------
{