Okay, for this battle engine I'm currently working on, any single character's creature can have up to 4 different/same moves. When they are in battle, it lists the moves and allows them to pick which one they wish to use for that turn. Now, what I need to do, is have the php connect to the MySQL, determine which moves the user's creature has available for the battle, and then detect the properties of the moves.
Now, the moves themselves have their own table in the MySQL, and the creatures have their own as well. In the creature's table, it lists the current moves that the creature has available. Now, I just don't know how to link the two. I'm working on a Beta version right now to be honest, and I just can't get it. Here's the coding...
<form>
<input type="radio" name="Move 1" value="<? $Move1 ?>">
<input type="radio" name="Move 2" value="<? $Move2 ?>">
<br>
<input type="radio" name="Move 3" value="<? $Move3 ?>">
<input type="radio" name="Move 4" value="<? $Move4 ?>">
<input type="submit" value="Attack">
</form>
<?
//BATTLE Part
$Move1 = mysql_query("SELECT * FROM Moves WHERE Attack='Fire'");
$Move2 = mysql_query("SELECT * FROM Moves WHERE Attack='Water'");
$Move3 = mysql_query("SELECT * FROM Moves WHERE Attack='Sliding Kick'");
$Move4 = mysql_query("SELECT * FROM Moves WHERE Attack='Super Punch'");
$EnemyHP = 8000;
function SpecialAttack($Level, $BasePower, $SpAtk, $SpDef, $Crit, $STAB, $Type1, $Type2){
$damage = floor(floor(floor(floor(floor(floor(floor(floor(floor(floor(2 + ($Level * 0.4)) * $BasePower * $SpAtk) / $SpDef) / 50) + 2) * $Crit) * (rand(85, 100)) / 100) * $STAB) * $Type1) * $Type2);
return $damage;
}
function Attack($Level, $BasePower, $Atk, $Def, $Crit, $STAB, $Type1, $Type2){
$damage = floor(floor(floor(floor(floor(floor(floor(floor(floor(floor(2 + ($Level * 0.4)) * $BasePower * $Atk) / $Def) / 50) + 2) * $Crit) * (rand(85, 100)) / 100) * $STAB) * $Type1) * $Type2);
return $damage;
}
$myNumber = 0;
echo "Before the function, myNumber = ". $myNumber ."<br />";
$SpA = SpecialAttack(1000, 120, 2115, 2155, 1.5, 1.5, 1.5, 1);
echo "After the function, Special Attack Damage = " . $SpA ."<br />";
$Atk = Attack(1000, 70, 2115, 2435, 1.5, 1.5, 1, 1);
echo "After the function, Attack Damage = " . $Atk ."<br />";
$New_EnemyHP = $EnemyHP - $SpA;
$EnemyHP = $New_EnemyHP;
echo "<br><br>".$EnemyHP."HP Remains";
$New_EnemyHP = $EnemyHP - $Atk;
$EnemyHP = $New_EnemyHP;
echo "<br><br>".$EnemyHP."HP Remains";
if(isset($_POST['Attack']')
{
$New_EnemyHP = $EnemyHP - $Atk;
$EnemyHP = $New_EnemyHP;
echo "<br><br>".$EnemyHP."HP Remains";
}
?>
Now, I really suck at forms. I know I do. I just can't figure out how to link the MySQL moves to the creatures current moves. I'll probably understand what I'm asking a bit better when I'm not typing all of this up. So, any questions for me, no problem...