public Character(Resources.Type type1, Resources.Type type2, string name, Resources.Rank rank, int level, Stat originalStats, Move[] currentMoves, Dictionary <int, Move> allMoves, Resources.Status status) { this.type1 = type1; this.type2 = type2; this.name = name; this.rank = rank; this.level = level; this.originalStats = originalStats; this.currentStats = new Stat(originalStats.getHp(), originalStats.getEnergy(), originalStats.getAtk(), originalStats.getSpatk(), originalStats.getDef(), originalStats.getSpdef(), originalStats.getSpd()); this.currentMoves = currentMoves; this.allMoves = allMoves; this.status = status; this.hpFactor = 0; this.energyFactor = 0; this.atkFactor = 0; this.spatkFactor = 0; this.defFactor = 0; this.spdefFactor = 0; this.spdFactor = 0; }
public void RemoveExpenses(Resources.Type type, int amount) { int current = Resources.instance.GetValue(type, false); int max = Resources.instance.GetValue(type, true); if (current + amount > max) { AddLoss(type, max - current - amount); amount = max - current; } for (int i = 0; i < expenses.Count; ++i) { if (expenses[i].type == type) { // if it exists increase it's (negative) magnitude: ScoreEntry entry = expenses[i]; entry.amount += amount; expenses[i] = entry; return; } } // otherwise add it: ScoreEntry e; e.type = type; e.amount = amount; expenses.Add(e); }
public void AddIncome(Resources.Type type, int amount) { int current = Resources.instance.GetValue(type, false); int max = Resources.instance.GetValue(type, true); if (current + amount > max) { AddLoss(type, max - current - amount); amount = max - current; } for (int i = 0; i < income.Count; ++i) { if (income[i].type == type) { // if it exists increase it's value: ScoreEntry entry = income[i]; entry.amount += amount; income[i] = entry; return; } } // otherwise add it: ScoreEntry e; e.type = type; e.amount = amount; income.Add(e); }
public DamageMove(string name, Resources.Type type, bool target, int accuracy, bool requireAim, int order, int cost, int penalty, bool physical, int damage, int critRate, int numHits, bool oneHitKO) : base(name, type, target, accuracy, requireAim, order, cost, penalty) { this.physical = physical; this.damage = damage; this.critRate = critRate; this.numHits = numHits; this.oneHitKO = oneHitKO; }
private static void DrawAlertButton(int alertLevel, Rect buttonWorkAlert, Resources.Type type) { if (Widgets.ButtonText( buttonWorkAlert, AlertManager.GetAlertPolicy(alertLevel, type).label, true, false, true)) { OpenPolicySelectMenu(type, alertLevel); } }
public Move(string name, Resources.Type type, bool target, int accuracy, bool requireAim, int order, int cost, int penalty) { this.name = name; this.type = type; this.target = target; this.accuracy = accuracy; this.requireAim = requireAim; this.order = order; this.cost = cost; this.penalty = penalty; }
private static void FillMenu(Resources.Type type, int alertLevel, List <FloatMenuOption> list, Policy policy) { list.Add( new FloatMenuOption( policy.label, delegate { AlertManager.SaveState( alertLevel, type, policy); }, MenuOptionPriority.Default, null, null, 0f, null)); }
private static void DoColumn( Rect rect, Policy policy, Resources.Type type) { GUI.BeginGroup(rect); WidgetRow widgetRow = new WidgetRow(0f, 0f, UIDirection.RightThenUp, 99999f, 4f); widgetRow.Gap(4f); if (policy != null) { widgetRow.Label(policy.label, 138f); if (widgetRow.ButtonText( "BPC.Rename".Translate(), null, true, false)) { Find.WindowStack.Add(new Dialog_RenamePolicy(policy, type)); } if (policy.id > 0 && widgetRow.ButtonIcon( ContentFinder <Texture2D> .Get( "UI/Buttons/Delete", true), null)) { switch (type) { case Resources.Type.assign: AssignManager.DeletePolicy(policy); break; case Resources.Type.animal: AnimalManager.DeletePolicy(policy); break; case Resources.Type.restrict: RestrictManager.DeletePolicy(policy); break; case Resources.Type.work: WorkManager.DeletePolicy(policy); break; } } } GUI.EndGroup(); }
public void AddLoss(Resources.Type type, int amount) { for (int i = 0; i < loss.Count; ++i) { if (loss[i].type == type) { // if it exists increase it's (negative) magnitude: ScoreEntry entry = loss[i]; entry.amount -= amount; loss[i] = entry; return; } } // otherwise add it: ScoreEntry e; e.type = type; e.amount = -amount; loss.Add(e); }
private float getEffectiveness(Resources.Type moveType, Character t) { Resources.Effectiveness eff1 = Resources.typeChart[moveType][t.getType1()]; Resources.Effectiveness eff2 = Resources.Effectiveness.Normal; if (t.getType2() != Resources.Type.None) { eff2 = Resources.typeChart[moveType][t.getType2()]; } if (eff1 == Resources.Effectiveness.None || eff2 == Resources.Effectiveness.None) { return(0f); } float result = 1f; if (eff1 == Resources.Effectiveness.Super) { result *= 2f; } else if (eff1 == Resources.Effectiveness.Weak) { result *= 0.5f; } if (eff2 == Resources.Effectiveness.Super) { result *= 2f; } else if (eff2 == Resources.Effectiveness.Weak) { result *= 0.5f; } return(result); }
private static void OpenPolicySelectMenu(Resources.Type type, int alertLevel) { List <FloatMenuOption> list = new List <FloatMenuOption>(); switch (type) { case Resources.Type.work: foreach (Policy policy in WorkManager.policies) { FillMenu(type, alertLevel, list, policy); } break; case Resources.Type.restrict: foreach (Policy policy in RestrictManager.policies) { FillMenu(type, alertLevel, list, policy); } break; case Resources.Type.assign: foreach (Policy policy in AssignManager.policies) { FillMenu(type, alertLevel, list, policy); } break; case Resources.Type.animal: foreach (Policy policy in AnimalManager.policies) { FillMenu(type, alertLevel, list, policy); } break; } Find.WindowStack.Add(new FloatMenu(list)); }
public StatMove(string name, Resources.Type type, bool target, int accuracy, bool requireAim, int order, int cost, int penalty, bool increase, Resources.StatType[] stats, int factor) : base(name, type, target, accuracy, requireAim, order, cost, penalty) { this.increase = increase; this.stats = stats; this.factor = factor; }
public Dialog_RenamePolicy(Policy policy, Resources.Type type) { this.policy = policy; this.curName = policy.label; this.type = type; }
public StatusMove(string name, Resources.Type type, bool target, int accuracy, bool requireAim, int order, int cost, int penalty, Resources.Status status) : base(name, type, target, accuracy, requireAim, order, cost, penalty) { this.status = status; }