blob: 7e886cf8ac230f12cc6dc79f02198404acee58a7 (
plain) (
blame)
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
|
using Gtk;
using Mundus.Data;
using Mundus.Data.Superlayers.Mobs;
using Mundus.Service.SuperLayers;
namespace Mundus.Service.Tiles.Mobs.Controllers {
public static class MobStatsController {
public static int GetPlayerHealth() {
return MI.Player.Health;
}
/// <summary>
/// Returns the stock_id of the hearth icon that must be used on the given position of the health bar
/// </summary>
/// <returns>stock_id of hearth icon</returns>
/// <param name="index">Health bar index</param>
public static string GetPlayerHearthStock(int index) {
string stock_id = "hearth_0";
int diff = GetPlayerHealth() - index * 4;
if (diff >= 4) stock_id = "hearth_4";
else if (diff == 1) stock_id = "hearth_1";
else if (diff == 2) stock_id = "hearth_2";
else if (diff == 3) stock_id = "hearth_3";
return stock_id;
}
public static void DamagePlayer(int damagePoints) {
if (!MI.Player.TakeDamage(damagePoints)) {
//do smth
}
}
/// <summary>
/// Heals the player (unless/until he has full health)
/// </summary>
/// <param name="healthPoints">Health points to heal with</param>
public static void HealPlayer(int healthPoints) {
MI.Player.Heal(healthPoints);
}
public static int GetPlayerEnergy() {
return (int)MI.Player.Energy;
}
/// <summary>
/// Returns the stock_id of the energy icon that must be used on the given position of the energy bar
/// </summary>
/// <returns>stock_id of energy icon</returns>
/// <param name="index">Energy bar index</param>
public static string GetPlayerEnergyStock(int index) {
string stock_id = "energy_0";
int diff = GetPlayerEnergy() - index * 6;
if (diff >= 6) stock_id = "energy_6";
else if (diff == 1) stock_id = "energy_1";
else if (diff == 2) stock_id = "energy_2";
else if (diff == 3) stock_id = "energy_3";
else if (diff == 4) stock_id = "energy_4";
else if (diff == 5) stock_id = "energy_5";
return stock_id;
}
public static void DrainEnergyPlayer(double energyPoints) {
MI.Player.DrainEnergy(energyPoints);
}
public static void RestoreEnergyPlayer(double energyPoints) {
MI.Player.RestoreEnergy(energyPoints);
}
/// <summary>
/// Returns the name of the superlayer the player is curently on
/// </summary>
public static string GetPlayerSuperLayerName() {
return MI.Player.CurrSuperLayer.ToString();
}
/// <summary>
/// Returns the player's horizontal (X) coordinates
/// </summary>
/// <returns>Player.XPos</returns>
public static int GetPlayerXCoord() {
return MI.Player.XPos;
}
/// <summary>
/// Returns the player's vertical (Y) coordinates
/// </summary>
/// <returns>Player.YPos</returns>
public static int GetPlayerYCoord() {
return MI.Player.YPos;
}
/// <summary>
/// Checks if the player has an an empty/non-solid tile directly on the superlayer above him
/// </summary>
public static bool ExistsHoleOnTopOfPlayer() {
//There can't be a hole if there isn't a layer above the player
if (HeightController.GetLayerAboveMob(MI.Player) == null) {
return false;
}
return HeightController.GetLayerAboveMob(MI.Player).GetGroundLayerTile(MI.Player.YPos, MI.Player.XPos) == null ||
!HeightController.GetLayerAboveMob(MI.Player).GetGroundLayerTile(MI.Player.YPos, MI.Player.XPos).Solid;
}
}
}
|