12
12
*/
13
13
namespace LuaUnit
14
14
{
15
+ /* *
16
+ * Sets a mechanic immunity for the [Unit].
17
+ *
18
+ * <pre>
19
+ * MECHANIC_NONE = 0,
20
+ * MECHANIC_CHARM = 1,
21
+ * MECHANIC_DISORIENTED = 2,
22
+ * MECHANIC_DISARM = 3,
23
+ * MECHANIC_DISTRACT = 4,
24
+ * MECHANIC_FEAR = 5,
25
+ * MECHANIC_GRIP = 6, // Called MECHANIC_FUMBLE in Classic/TBC
26
+ * MECHANIC_ROOT = 7,
27
+ * MECHANIC_PACIFY = 8,
28
+ * MECHANIC_SILENCE = 9,
29
+ * MECHANIC_SLEEP = 10,
30
+ * MECHANIC_SNARE = 11,
31
+ * MECHANIC_STUN = 12,
32
+ * MECHANIC_FREEZE = 13,
33
+ * MECHANIC_KNOCKOUT = 14,
34
+ * MECHANIC_BLEED = 15,
35
+ * MECHANIC_BANDAGE = 16,
36
+ * MECHANIC_POLYMORPH = 17,
37
+ * MECHANIC_BANISH = 18,
38
+ * MECHANIC_SHIELD = 19,
39
+ * MECHANIC_SHACKLE = 20,
40
+ * MECHANIC_MOUNT = 21,
41
+ * MECHANIC_INFECTED = 22, // Called MECHANIC_PERSUADE in Classic/TBC
42
+ * MECHANIC_TURN = 23,
43
+ * MECHANIC_HORROR = 24,
44
+ * MECHANIC_INVULNERABILITY = 25,
45
+ * MECHANIC_INTERRUPT = 26,
46
+ * MECHANIC_DAZE = 27,
47
+ * MECHANIC_DISCOVERY = 28,
48
+ * MECHANIC_IMMUNE_SHIELD = 29, // Divine (Blessing) Shield/Protection and Ice Block
49
+ * MECHANIC_SAPPED = 30,
50
+ * MECHANIC_ENRAGED = 31 // Not used in Classic/TBC
51
+ * </pre>
52
+ *
53
+ * @param int32 immunity : new value for the immunity mask
54
+ * @param bool apply = true : if true, the immunity is applied, otherwise it is removed
55
+ */
56
+ int SetImmuneTo (Eluna* E, Unit* unit)
57
+ {
58
+ int32 immunity = Eluna::CHECKVAL<int32>(E->L , 2 );
59
+ bool apply = Eluna::CHECKVAL<bool >(E->L , 3 , true );
60
+
61
+ #ifndef CATA
62
+ unit->ApplySpellImmune (nullptr , 5 , immunity, apply);
63
+ #else
64
+ unit->ApplySpellImmune (0 , 5 , immunity, apply);
65
+ #endif
66
+ return 0 ;
67
+ }
68
+
15
69
/* *
16
70
* The [Unit] tries to attack a given target
17
71
*
@@ -2490,13 +2544,6 @@ namespace LuaUnit
2490
2544
{ " GetStat" , &LuaUnit::GetStat },
2491
2545
{ " GetBaseSpellPower" , &LuaUnit::GetBaseSpellPower },
2492
2546
{ " GetMovementType" , &LuaUnit::GetMovementType },
2493
- #if defined(WOTLK)
2494
- { " GetCritterGUID" , &LuaUnit::GetCritterGUID },
2495
- { " GetVehicleKit" , &LuaUnit::GetVehicleKit },
2496
- #else
2497
- { " GetCritterGUID" , nullptr , METHOD_REG_NONE },
2498
- { " GetVehicleKit" , nullptr , METHOD_REG_NONE },
2499
- #endif
2500
2547
2501
2548
// Setters
2502
2549
{ " SetFaction" , &LuaUnit::SetFaction },
@@ -2525,15 +2572,7 @@ namespace LuaUnit
2525
2572
{ " SetStandState" , &LuaUnit::SetStandState },
2526
2573
{ " SetInCombatWith" , &LuaUnit::SetInCombatWith },
2527
2574
{ " ModifyPower" , &LuaUnit::ModifyPower },
2528
- #if defined(WOTLK)
2529
- { " SetFFA" , &LuaUnit::SetFFA },
2530
- { " SetSanctuary" , &LuaUnit::SetSanctuary },
2531
- { " SetCritterGUID" , &LuaUnit::SetCritterGUID },
2532
- #else
2533
- { " SetFFA" , nullptr , METHOD_REG_NONE },
2534
- { " SetSanctuary" , nullptr , METHOD_REG_NONE },
2535
- { " SetCritterGUID" , nullptr , METHOD_REG_NONE },
2536
- #endif
2575
+ { " SetImmuneTo" , &LuaUnit::SetImmuneTo },
2537
2576
2538
2577
// Boolean
2539
2578
{ " IsAlive" , &LuaUnit::IsAlive },
@@ -2574,11 +2613,6 @@ namespace LuaUnit
2574
2613
{ " HasAura" , &LuaUnit::HasAura },
2575
2614
{ " IsCasting" , &LuaUnit::IsCasting },
2576
2615
{ " IsStandState" , &LuaUnit::IsStandState },
2577
- #if defined(TBC) || defined(WOTLK)
2578
- { " IsOnVehicle" , &LuaUnit::IsOnVehicle },
2579
- #else
2580
- { " IsOnVehicle" , nullptr , METHOD_REG_NONE },
2581
- #endif
2582
2616
2583
2617
// Other
2584
2618
{ " AddAura" , &LuaUnit::AddAura },
@@ -2619,14 +2653,26 @@ namespace LuaUnit
2619
2653
{ " MoveClear" , &LuaUnit::MoveClear },
2620
2654
{ " DealDamage" , &LuaUnit::DealDamage },
2621
2655
{ " DealHeal" , &LuaUnit::DealHeal },
2656
+
2657
+ // Expansion specific methods
2622
2658
#if defined(TBC) || defined(WOTLK)
2659
+ { " IsOnVehicle" , &LuaUnit::IsOnVehicle },
2623
2660
{ " RemoveArenaAuras" , &LuaUnit::RemoveArenaAuras },
2624
- #else
2625
- { " RemoveArenaAuras" , nullptr , METHOD_REG_NONE },
2626
- #endif
2627
- #if defined(WOTLK)
2661
+ #elif defined(WOTLK)
2662
+ { " GetCritterGUID" , &LuaUnit::GetCritterGUID },
2663
+ { " GetVehicleKit" , &LuaUnit::GetVehicleKit },
2664
+ { " SetFFA" , &LuaUnit::SetFFA },
2665
+ { " SetSanctuary" , &LuaUnit::SetSanctuary },
2666
+ { " SetCritterGUID" , &LuaUnit::SetCritterGUID },
2628
2667
{ " MoveJump" , &LuaUnit::MoveJump },
2629
2668
#else
2669
+ { " GetCritterGUID" , nullptr , METHOD_REG_NONE },
2670
+ { " GetVehicleKit" , nullptr , METHOD_REG_NONE },
2671
+ { " SetFFA" , nullptr , METHOD_REG_NONE },
2672
+ { " SetSanctuary" , nullptr , METHOD_REG_NONE },
2673
+ { " SetCritterGUID" , nullptr , METHOD_REG_NONE },
2674
+ { " IsOnVehicle" , nullptr , METHOD_REG_NONE },
2675
+ { " RemoveArenaAuras" , nullptr , METHOD_REG_NONE },
2630
2676
{ " MoveJump" , nullptr , METHOD_REG_NONE },
2631
2677
#endif
2632
2678
@@ -2644,7 +2690,6 @@ namespace LuaUnit
2644
2690
{ " RemoveCharmAuras" , nullptr , METHOD_REG_NONE }, // not implemented
2645
2691
{ " DisableMelee" , nullptr , METHOD_REG_NONE }, // not implemented
2646
2692
{ " SummonGuardian" , nullptr , METHOD_REG_NONE }, // not implemented
2647
- { " SetImmuneTo" , nullptr }, // not implemented
2648
2693
2649
2694
{ NULL , NULL , METHOD_REG_NONE }
2650
2695
};
0 commit comments