Fix hair, dick around with new game screen.
[18plus-7leafadventure.git] / src / org / sevenchan / dongs / enchantment / Corruption.as
blob115353761b92412bb5086749801a5c99b8677fb3
1 package org.sevenchan.dongs.enchantment
3 import flash.net.registerClassAlias;
4 import org.sevenchan.dongs.Creature;
5 import org.sevenchan.dongs.creature.Demon;
6 import org.sevenchan.dongs.creature.Player;
7 import org.sevenchan.dongs.screens.InfoScreen;
8 /**
9 * Oh look I made an STD
10 * @author Harbinger
12 public class Corruption extends Enchantment
14 registerClassAlias("ECorruption", Corruption);
15 public var level:Number;
16 public var host:Creature;
17 public function Corruption(amt:Number)
19 super();
20 level = amt;
23 override public function getName():String
25 return "Corruption";
28 override public function getDescr():String
30 return "Then John was the demons. Current level: " + level;
33 override public function onInit(newHost:Creature):String
35 host = newHost;
36 if (level == -1) {
37 level = 0;
38 cancelAddition = true;
39 delete newHost.enchantments[getID()];
40 return "You are no longer corrupted.";
42 if (newHost.enchantments[getID()] != null) {
43 (newHost.enchantments[getID()] as Corruption).level += level;
44 cancelAddition = true;
45 if (level >= 100)
47 if(host is Player) {
48 (host as Player).changeTo(new Demon());
49 } else {
50 var oldHost:Creature = host;
51 host = new Demon();
52 host.changeFrom(oldHost);
54 level = 100;
56 return "Your corruption level has increased to level "+getLevelOf(newHost)+".";
57 } else {
58 if(host is Player) {
59 var ply:Player = Player(host);
60 if (!ply.getExplored("corruptionintro")) {
61 ply.setExplored("corruptionintro");
62 InfoScreen.push("<h2>Corrupted</h2><p>You are now " + level + "% corrupted. If this reaches 100%, you will become a Demon.</p><p>Check your appearance screen to see your effects.</p>");
65 return "You are now corrupted.";
67 if (statbar == null && host is Player) {
68 statbar = (newHost as Player).AdventureController.createNewStatusBar();
72 public static function getLevelOf(host:Creature):Number {
73 if (host.enchantments["corruption"] != null)
74 return (host.enchantments["corruption"] as Corruption).level;
75 return 0;
78 override public function onCombatComplete(hostWon:Boolean, other:Creature):void
82 override public function getID():String
84 return "corruption";