/
EmpoweringCore.cs
83 lines (76 loc) · 3.37 KB
/
EmpoweringCore.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using ItemAPI;
using Dungeonator;
using System.Reflection;
using Random = System.Random;
using FullSerializer;
using System.Collections;
using Gungeon;
using MonoMod.RuntimeDetour;
using MonoMod;
namespace BunnyMod
{
public class EmpoweringCore : PassiveItem
{
public static void Init()
{
string itemName = "Empowering Core";
string resourceName = "BunnyMod/Resources/empoweringcore.png";
GameObject obj = new GameObject(itemName);
var item = obj.AddComponent<EmpoweringCore>();
ItemBuilder.AddSpriteToObject(itemName, resourceName, obj);
string shortDesc = "Powe Eterna";
string longDesc = "A pure energy core. No flaws, no diminishing returns. Just pure eternal power.";
ItemBuilder.SetupItem(item, shortDesc, longDesc, "bny");
ItemBuilder.AddPassiveStatModifier(item, PlayerStats.StatType.Damage, 1.40f, StatModifier.ModifyMethod.MULTIPLICATIVE);
item.quality = PickupObject.ItemQuality.S;
List<string> mandatoryConsoleIDs2 = new List<string>
{
"bny:empowering_core",
"bny:broken_core"
};
CustomSynergies.Add("Ego Sum Aeternae", mandatoryConsoleIDs2, null, true);
}
private void OnEnemyDamaged(float damage, bool fatal, HealthHaver enemyHealth)
{
bool flag2 = base.Owner.PlayerHasActiveSynergy("Ego Sum Aeternae");
if (flag2)
{
if (enemyHealth.specRigidbody != null)
{
bool y = enemyHealth.aiActor && UnityEngine.Random.value <= 0.0714f;
if (y)
{
Projectile projectile = ((Gun)ETGMod.Databases.Items[508]).DefaultModule.projectiles[0];
GameObject gameObject = SpawnManager.SpawnProjectile(projectile.gameObject, base.Owner.sprite.WorldCenter, Quaternion.Euler(0f, 0f, ((base.Owner.CurrentGun == null) ? 1.2f : base.Owner.CurrentGun.CurrentAngle)), true);
Projectile component = gameObject.GetComponent<Projectile>();
bool flag = component != null;
bool r = flag;
if (r)
{
component.Owner = base.Owner;
component.Shooter = base.Owner.specRigidbody;
component.baseData.speed = 100f;
component.baseData.damage = 40f;
}
}
}
}
}
public override void Pickup(PlayerController player)
{
player.OnAnyEnemyReceivedDamage += (Action<float, bool, HealthHaver>)Delegate.Combine(player.OnAnyEnemyReceivedDamage, new Action<float, bool, HealthHaver>(this.OnEnemyDamaged));
base.Pickup(player);
}
public override DebrisObject Drop(PlayerController player)
{
player.OnAnyEnemyReceivedDamage -= (Action<float, bool, HealthHaver>)Delegate.Combine(player.OnAnyEnemyReceivedDamage, new Action<float, bool, HealthHaver>(this.OnEnemyDamaged));
return base.Drop(player);
}
//private float LaserTrue = 20f;
}
}