Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <?php
- $classColors = array (
- 'Wizard' => 'blue',
- 'Warrior' => 'brown'
- );
- function getClass($qClass)
- {
- global $classColors;
- foreach($classColors as $class => $color)
- {
- if($qClass == $class)
- {
- return($color);
- }
- }
- }
- function getRoll()
- {
- global $turn;
- $pRoll = rand(1 , 10);
- $npcRoll = rand(1 , 10);
- if($npcRoll > $pRoll)
- {
- $turn = 0;
- }
- elseif($pRoll > $npcRoll)
- {
- $turn = 1;
- }
- else{
- $turn = rand(0 , 1);
- }
- }
- function checkHealth()
- {
- global $npcHealth, $pHealth;
- if($pHealth < 1)
- {
- print("$pName has been DEFEATED!");
- }
- elseif($npcHealth < 1)
- {
- return(true);
- }
- else
- {
- return("You Dumb Kid!");
- }
- }
- $turn = NULL;
- $pName = 'Ecko';
- $pClass = 'Wizard';
- $pHealth = 30;
- $npcName = 'Orcish Brute';
- $npcClass = 'Warrior';
- $npcHealth = 30;
- $getColor = getClass($pClass);
- $roll = getRoll();
- ?>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <font color="<?php print($getColor) ?>"><?php print($pName) ?></font>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement