-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Plugin.cs
119 lines (102 loc) · 4.41 KB
/
Plugin.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
using BepInEx;
using BepInEx.Logging;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using System.IO;
using DiskCardGame;
using HarmonyLib;
using UnityEngine;
using APIPlugin;
namespace CardLoaderMod
{
[BepInPlugin(PluginGuid, PluginName, PluginVersion)]
[BepInDependency("cyantist.inscryption.api", BepInDependency.DependencyFlags.HardDependency)]
public class Plugin : BaseUnityPlugin
{
private const string PluginGuid = "cyantist.inscryption.customcardexample";
private const string PluginName = "CustomCardModExample";
private const string PluginVersion = "1.0.0.0";
private void Awake()
{
Logger.LogInfo($"Loaded {PluginName}!");
AddBears();
AddAbility();
ChangeWolf();
}
private void AddBears()
{
List<CardMetaCategory> metaCategories = new List<CardMetaCategory>();
metaCategories.Add(CardMetaCategory.ChoiceNode);
metaCategories.Add(CardMetaCategory.Rare);
List<CardAppearanceBehaviour.Appearance> appearanceBehaviour = new List<CardAppearanceBehaviour.Appearance>();
appearanceBehaviour.Add(CardAppearanceBehaviour.Appearance.RareCardBackground);
byte[] imgBytes = System.IO.File.ReadAllBytes(Path.Combine(this.Info.Location.Replace("CardLoaderMod.dll",""),"Artwork/eightfuckingbears.png"));
Texture2D tex = new Texture2D(2,2);
tex.LoadImage(imgBytes);
NewCard.Add("Eight_Bears", metaCategories, CardComplexity.Simple, CardTemple.Nature,"8 fucking bears!",32,48,description:"Kill this abomination please",cost:3,appearanceBehaviour:appearanceBehaviour, tex:tex);
}
private NewAbility AddAbility()
{
AbilityInfo info = ScriptableObject.CreateInstance<AbilityInfo>();
info.powerLevel = 0;
info.rulebookName = "Example Ability";
info.rulebookDescription = "Example ability which adds a PiggyBank!";
info.metaCategories = new List<AbilityMetaCategory> {AbilityMetaCategory.Part1Rulebook, AbilityMetaCategory.Part1Modular};
List<DialogueEvent.Line> lines = new List<DialogueEvent.Line>();
DialogueEvent.Line line = new DialogueEvent.Line();
line.text = "New abilities? I didn't authorise homebrew!";
lines.Add(line);
info.abilityLearnedDialogue = new DialogueEvent.LineSet(lines);
byte[] imgBytes = System.IO.File.ReadAllBytes(Path.Combine(this.Info.Location.Replace("CardLoaderMod.dll",""),"Artwork/new.png"));
Texture2D tex = new Texture2D(2,2);
tex.LoadImage(imgBytes);
NewAbility ability = new NewAbility(info,typeof(NewTestAbility),tex,AbilityIdentifier.GetAbilityIdentifier(PluginGuid, info.rulebookName));
NewTestAbility.ability = ability.ability;
return ability;
}
private void ChangeWolf()
{
List<Ability> abilities = new List<Ability> {NewTestAbility.ability};
new CustomCard("Wolf") {baseAttack=10, abilities=abilities};
}
public class NewTestAbility : AbilityBehaviour
{
public override Ability Ability
{
get
{
return ability;
}
}
public static Ability ability;
public override bool RespondsToResolveOnBoard()
{
return true;
}
public override IEnumerator OnResolveOnBoard()
{
yield return base.PreSuccessfulTriggerSequence();
yield return new WaitForSeconds(0.2f);
Singleton<ViewManager>.Instance.SwitchToView(View.Default, false, false);
yield return new WaitForSeconds(0.25f);
if (RunState.Run.consumables.Count < 3)
{
RunState.Run.consumables.Add("PiggyBank");
Singleton<ItemsManager>.Instance.UpdateItems(false);
}
else
{
base.Card.Anim.StrongNegationEffect();
yield return new WaitForSeconds(0.2f);
Singleton<ItemsManager>.Instance.ShakeConsumableSlots(0f);
}
yield return new WaitForSeconds(0.2f);
yield return base.LearnAbility(0f);
yield break;
}
}
}
}