forked from acegiak/qudkissing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInterruptSkill.cs
132 lines (110 loc) · 3.21 KB
/
InterruptSkill.cs
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
using System;
using System.Collections.Generic;
using XRL.Messages;
using XRL.Rules;
using XRL.UI;
using XRL.Language;
using XRL.World.Effects;
using XRL.World.AI.GoalHandlers;
namespace XRL.World.Parts.Skill
{
[Serializable]
public class acegiak_Interrupt : BaseSkill
{
public Guid ActivatedAbilityID = Guid.Empty;
public ActivatedAbilityEntry Ability = null;
public acegiak_Interrupt()
{
DisplayName = "Interrupt";
}
public override bool AllowStaticRegistration()
{
return true;
}
public override void Register(GameObject Object)
{
Object.RegisterPartEvent(this, "CommandAcegiakInterrupt");
base.Register(Object);
}
public bool Interrupt(Cell C, bool flag)
{
//IPart.AddPlayerMessage("Interruptmin");
if (C != null)
{
foreach (GameObject target in C.GetObjectsInCell()){
if (target.IsInvalid() || target.GetPart<Brain>() == null || !target.GetPart<Brain>().IsHostileTowards(ParentObject)){
continue;
}
int check = 18;
acegiak_Kissable kissable = target.GetPart<acegiak_Kissable>();
if(kissable != null){
check += ((int)(kissable.attractionAmount(ParentObject)*3f));
}
if(!target.MakeSave("Willpower",check,ParentObject,null,"Hesitation")){
target.ApplyEffect(new acegiak_EffectHesitation());
CooldownMyActivatedAbility(ActivatedAbilityID, 50);
acegiak_Romancable romancable = target.GetPart<acegiak_Romancable>();
if(romancable != null){
romancable.patience = 10;
}
IPart.AddPlayerMessage(target.DisplayName+" hesitates.");
target.ParticleText("?");
return true;
}
}
}
return false;
}
public override bool FireEvent(Event E)
{
if (E.ID == "CommandAcegiakInterrupt")
{
bool flag = ParentObject.IsMissingTongue();
if (flag && !ParentObject.HasPart("Telepathy"))
{
if (ParentObject.IsPlayer())
{
Popup.ShowBlock("You cannot Interrupt without a tongue.");
}
return true;
}
if (!ParentObject.CheckFrozen(Telepathic: true))
{
return true;
}
Cell cell = PickDestinationCell(80, AllowVis.OnlyVisible, Locked: true, IgnoreSolid: false, IgnoreLOS: true, RequireCombat: true, PickTarget.PickStyle.EmptyCell, null, Snap: true);
if (cell == null)
{
return true;
}
if (ParentObject.DistanceTo(cell) > 8 && !ParentObject.HasPart("Telepathy"))
{
if (ParentObject.IsPlayer())
{
Popup.Show("That is out of range! (" + 8 + " squares)");
}
return true;
}
if (cell != null)
{
int intProperty = ParentObject.GetIntProperty("Horrifying");
int turns = Math.Max(50 - intProperty * 10, 10);
CooldownMyActivatedAbility(ActivatedAbilityID, turns);
Interrupt(cell, flag);
UseEnergy(1000, "Skill Persuasion Interrupt");
}
}
return base.FireEvent(E);
}
public override bool AddSkill(GameObject GO)
{
ActivatedAbilityID = AddMyActivatedAbility("Interrupt", "CommandAcegiakInterrupt", "Skill", null, "\u0014");
return true;
}
public override bool RemoveSkill(GameObject GO)
{
RemoveMyActivatedAbility(ref ActivatedAbilityID);
return true;
}
}
}