From bef19795cac190a137564fb8a4f0d4ed5b1c5899 Mon Sep 17 00:00:00 2001 From: Rain Clark Date: Fri, 7 Oct 2016 01:19:45 -0400 Subject: [PATCH] Added Fail Chance & Age Bonus to study :book: - Fail Chance based on Discipline - Age Bonus give +1 Int per 4 days alive --- source/Gel.hx | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/source/Gel.hx b/source/Gel.hx index 31f3071..7d51ba2 100644 --- a/source/Gel.hx +++ b/source/Gel.hx @@ -11,7 +11,7 @@ class Gel extends FlxSprite // Usless Stats that have no pupose yet public var Intellect:Int = 1; // had to be somewhat smart to get out of the egg - public var Age:Int = 0; + public var Age:Int = 1; // Mood Modifiers public var Happiness:Int = 50; @@ -95,9 +95,7 @@ class Gel extends FlxSprite private function checkMood():Void { if (_isAsleep) - { CurrentMood = SLEEPING; - } else { if (Happiness >= 61) @@ -167,15 +165,24 @@ class Gel extends FlxSprite public function Study():Void { - // TODO: Add study faliure chance - // TODO: Add Age bonus - if (!_hasStudied) + var _ageBonus:Float = Age/4; + + if (FlxG.random.bool(Discipline)) { - Intellect++; - Happiness -= 5; - Fullness -= 5; - Sleepiness += 15; + if (!_hasStudied && !_isTired) + { + Intellect += (1 * (1 + Std.int(_ageBonus))); + Happiness -= 5; + Fullness -= 5; + Sleepiness += 15; + // TODO: play ashamed animation + } } + else + { + // TODO: Play ashamed animation + } + // Can only study once per hour, even if check failed _hasStudied = true; }