MediaWiki:Javascript-ungames-TestGame.js/database.js

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search

Note: After saving, you have to bypass your browser's cache to see the changes.

  • Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
  • Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
  • Opera, Konqueror and Safari users can just click the Reload button.
  • Chrome: press Ctrl+F5 or Shift+F5
var ABILITY_DATABASE = {
	// Should be kept blank
	none: new Ability({}),
	// Abilities
	sturdy: new Ability({
		// The sturdy ability will keep a creature safe from dying if it is on full health
		getRealDamage: (damage, creature) => {
			if (creature.maxHealth === creature.health) {
				if (damage.amount >= creature.health) {
					return creature.health - 1;
				}
			}
		}
	}),
	storyEating: new Ability({
		// The story eating ability makes it take less damage from attacks which would kill it, and take almost no damage from attacks which wouldn't
		getRealDamage: (damage, creature) => {
			if (damage.amount > creature.health) {
				return Math.ceil(damage.amount / 7);
			} else {
				// TODO: allow setting custom text to display when telling the player it had no effect
				return Math.ceil(damage.amount / 25);
			}
		}
	}),
};


var ATTACK_DATABASE = {
	scratch: new Attack({
		name: "Scratch",
		description: "Scratch the target with claws, dealing a small amount of damage.",
		damage: 30,
		accuracy: 100,
		priority: 1,
		damageType: Attack.DamageTypePhysical,
		specialEffects: (attacker, target, wasDamageDealt) => {
			// Nothing
		}
	})
};


var CREATURE_DATABASE = {
	"orangeKitten": {
		name: "Orange Kitten",
		description: "The orange ones fuck you up REAL good.",
		ability: ABILITY_DATABASE.none,
		image: "https://images.uncyclomedia.co/uncyclopedia/en/3/38/Orange_kitten-transparent.png",
		stats: {
			health: 6,
			attack: 3,
			defence: 4,
			spAttack: 3,
			spDefence: 2,
			speed: 3
		},
		attacks: [
			ATTACK_DATABASE.scratch,
		]
	},
	"nikoOneshot": {
		name: "Niko Oneshot",
		description: "",
		image: "https://images.uncyclomedia.co/uncyclopedia/en/4/49/Niko_oneshot.png",
		ability: ABILITY_DATABASE.none,
		stats: {
			health: 6,
			attack: 2,
			defence: 3,
			spAttack: 2,
			spDefence: 3,
			speed: 5
		},
		attacks: [
			ATTACK_DATABASE.scratch,
		]
	},
	"storyEatingCat": {
		name: "Story Eating Cat",
		description: "Eater of stories, will eat everything. Including your face.",
		image: "https://images.uncyclomedia.co/uncyclopedia/en/7/7e/Eating.gif",
		ability: ABILITY_DATABASE.storyEating,
		stats: {
			health: 8,
			attack: 4,
			defence: 6,
			spAttack: 4,
			spDefence: 5,
			speed: 6
		},
		attacks: [
			ATTACK_DATABASE.scratch,
		]
	},
};


// Everything has loaded
onLoaded();