Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Trap {
- // All Creatures have the following properties:
- protected string trapName; //A "hallway of scything blades" stands before you.
- private int trapDisarmDifficultyValue; //Secretly modifies result of Mechanics roll. -0, -15, -30
- private int trapDisarmDifficultyDescription; //This trap...
- //At -0, "<color=white>looks simple to disarm</color>"
- //At -15, "<color=yellow>is of concerning difficulty to bypass</color>"
- //At -30, "<color=orange>is fiendishly complex to understand, let alone disable</color>"
- private string trapDamageDescription; //Like Creature weapon description. "Whirling blades" | "Crushing stone block" | "fusillade of envenomed darts" etc.
- private int trapDamage; //Numerical damage dealt
- private int trapMaxHealth; //How much damage the trap can endure before being smashed apart.
- private int damageTaken; //As in Creature
- // This is the object that'll get called with parameters in order to actually create a trap.
- public Trap (string trapName, int trapDisarmDifficultyValue, int trapDisarmDifficultyDescription, string trapDamageDescription, int trapDamage, int trapMaxHealth, int damageTaken)
- {
- this.trapName = trapName;
- this.trapDisarmDifficultyValue = trapDisarmDifficultyValue;
- this.trapDisarmDifficultyDescription = trapDisarmDifficultyDescription;
- this.trapDamageDescription = trapDamageDescription;
- this.trapDamage = trapDamage;
- this.trapMaxHealth = trapMaxHealth;
- this.damageTaken = 0;
- }
- public bool isDead ()
- {
- return damageTaken >= trapMaxHealth;
- }
- public int getCurrentHealth ()
- {
- if (isDead ()) {
- return 0;
- } else {
- return trapMaxHealth - damageTaken;
- }
- }
- public int getMaxHealth ()
- {
- return trapMaxHealth;
- }
- protected void setMaxHealth (int maxHealth)
- {
- this.trapMaxHealth = maxHealth;
- }
- public void applyDamage (int damage)
- {
- this.damageTaken += damage;
- }
- public void healDamage (int damage)
- {
- this.damageTaken -= damage;
- if (damageTaken < 0) {
- damageTaken = 0;
- }
- }
- // functions for getting and setting trapDisarmDifficultyValue
- public int getDisarmDifficulty ()
- {
- return trapDisarmDifficultyValue;
- }
- protected void setDisarmDifficulty (int trapDisarmDifficultyValue)
- {
- this.trapDisarmDifficultyValue = trapDisarmDifficultyValue;
- }
- // functions for getting and setting trapDisarmDifficultyDescription
- public int getDisarmDifficultyDescription ()
- {
- return trapDisarmDifficultyDescription;
- }
- protected void setDisarmDifficultyDescription (int trapDisarmDifficultyDescription)
- {
- this.trapDisarmDifficultyDescription = trapDisarmDifficultyDescription;
- }
- // functions for getting and setting trap damage description and damage value
- public string getDamageDescription ()
- {
- return trapDamageDescription;
- }
- public void setDamageDescription (string trapDamageDescription)
- {
- this.trapDamageDescription = trapDamageDescription;
- }
- public int getTrapDamage ()
- {
- return trapDamage;
- }
- protected void setTrapDamage (int trapDamage)
- {
- this.trapDamage = trapDamage;
- }
- // Functions for miscellaneous creature stuff that still ought to be encapsulated
- public string getTrapName ()
- {
- //return creatureName;
- return trapName;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement