public string action( StructPlayer self, StructPlayer target, string actionName, string actionType, int actionPower) { string report; if (actionType == "heal") { report = self.name + " healed for " + actionPower.ToString() + "(" + actionName + ")"; self.hitPointCurrent += actionPower; return report; } if (actionType == "damage") { report = self.name + " damaged " + target.name + " for " + actionPower.ToString() + "(" + actionName + ")"; target.hitPointCurrent -= actionPower; return report; } if (actionType == "criticalPower") { self.criticalPower += actionPower; } if (actionType == "criticalChance") { self.criticalChance += actionPower; } if (actionType == "hitpointSet") { self.hitPointCurrent = actionPower; } return ""; }
public static StructPlayer getPlayerInfo( string name ) { string filePath = Program.path + @"\players\" + name + @".up"; StreamReader fileReading = File.OpenText(filePath); StructPlayer playerReading = new StructPlayer(); playerReading.name = name; fileReading.ReadLine(); playerReading.level = Convert.ToInt32(fileReading.ReadLine()); fileReading.ReadLine(); playerReading.hitPointMax = Convert.ToInt32(fileReading.ReadLine()); fileReading.ReadLine(); playerReading.attackPower = Convert.ToInt32(fileReading.ReadLine()); return playerReading; }
public string attack( StructPlayer target) { return target.gettingDamage( this, attackPower); }
public string gettingDamage(StructPlayer opponent, int damage) { hitPointCurrent -= damage; return opponent.name + " damaged " + this.name + " for " + damage.ToString() + " \n "; }