Sunteți pe pagina 1din 21

This is the full code of our RPG battle loop.

Everything is under the RpgTutorial Namespace Maingame


class MainGame { List<Character> Monster; Hero myhero; Battle battle; string answer; public MainGame() { Console !riteLine("!elcome to the arena#"); myhero $ new Hero(); Hero %nitiali&e(myhero); Monster $ new List<Character>(); BasicGameLoop(); ' (oi) BasicGameLoop() { )o { Console !riteLine(); Console !rite(*" !hat woul) you li+e to )o, ----------------------------(.)ight (/)tore (%)nn (0)iew (1)uit -----------------------------"); Console !riteLine(); answer $ Console 2ea)Line(); Console !riteLine(); switch (answer) { case "/"3 case "s"3 /tore store $ new /tore(myhero); brea+; case "%"3 case "i"3 %nn /leep(myhero); brea+; case "("3 case "0"3 0iew 4rint/tats(myhero); brea+; case "."3 case "5"3 string )one $""; )o

Console !rite(*" !hich monster )o you want to 5ight, (/)lime3 (B)arbarian3 (M)age3 -------------------------"); Console !riteLine(); string choice $ Console 2ea)Line(); i5 (choice $$ "/" 66 choice $$ "s") { Monster 7))(new /lime()); ' else i5 (choice $$ "B" 66 choice $$ "b") { Monster 7))(new Barbarian()); ' else i5 (choice $$ "M" 66 choice $$ "m") { Monster 7))(new Mage()); ' else { Monster 7))(new /lime()); ' Console !riteLine("!oul) you li+e to 5ight more monsters,"); Console !riteLine(); )one $ Console 2ea)Line(); ' while ()one $$"8"66)one $$ "y"); battle $ new Battle(myhero9 Monster); i5 (myhero CurrentHealth <$ :) { Console !riteLine("8our game is o(er#"); continue; ' else i5 (myhero 5le) $$ 5alse) { int gol) $ :; int e;perience $ :; 5oreach (Character monster in Monster) { i5 (monster 5le) $$ 5alse) { e;perience <$ monster =;perience; gol) <$ monster Gol); ' ' Console !riteLine("{:' gets {>' gol) an) {?' e;perience" 9 myhero %)enti5ier9 gol)9 e;perience); myhero =;perience <$ e;perience; myhero Gol) <$ gol); Monster Clear();

continue

"); ' else {

Console !riteLine("4ress enter to Console 2ea)Line();

myhero 5le) $ 5alse; ' brea+; case "1"3 case "@"3 Console !riteLine("Goo)bye {:'"9 myhero %)enti5ier); ' brea+;

' '

' while (answer #$ "1" AA answer #$ "@");

Inn
public class %nn { BBB <summary> BBB Here is our inn9 which gi(es our hero a chance to rest BBB <Bsummary> BBB <param name$"hero">Cur current hero<Bparam> public static (oi) /leep(Hero hero) { string answer $ ""; Console Clear(); Console !riteLine("Hello an) welcome to the %nn9 itDs E gol) to stay"); )o { Console !riteLine("!hat can % )o 5or you,"); Console !rite(*" (2)est (F)one "); answer $ Console 2ea)Line(); Console !riteLine(); switch (answer) { case "2"3 case "r"3 i5 (hero Gol) >$ E) { hero Gol) G$ E; Console !riteLine("7lright9 enHoy your stay"); hero CurrentHealth $ hero Ma;Health; hero CurrentMagic $ hero Ma;Magic; ' else { Console !riteLine("Hey you )onDt ha(e

enough gol)#");

that "); '

' brea+; case "F"3 case ")"3 Console !riteLine("Be care5ul out there#"); brea+; )e5ault3 Console !riteLine("!hat, % )onDt un)erstan) brea+;

' while (answer #$ "F" AA answer #$ ")"); Console !riteLine("4ress enter to continue Console Clear(); ' '

");

Store
BBB <summary> BBB Ihis is a (ery simple store with Hust BBB !e coul) alternati(ely ma+e each item to a string BBB Ihe const +eywor) in)icates that this will not change BBB <Bsummary> class /tore { const string armor $ "7rmor"; const string helmet $ "Helmet"; const string swor) $ "/wor)"; string choice $ ""; public /tore(Hero hero) { Console Clear(); Console !riteLine("!elcome to the /toreLoop(hero); ' public (oi) /toreLoop(Hero hero) { )o { bool chec+item $ 5alse; Console !riteLine("!hat woul) Console !rite(*" (/)wor)3 >:: gol) <? 7ttac+ (H)elmet3 J: gol) <> Fe5ense (7)rmor3 >?K gol) <J Fe5ense (F)one3 "); Console !riteLine(); choice $ Console 2ea)Line(); switch (choice) { case "/"3 a 5ew items itDs own class as oppose) string is a constant an)

store#");

you li+e to buy,");

case "s"3 chec+item $ hero Chec+%tems(swor)); i5 (chec+item $$ 5alse) { i5 (hero Gol) >$ >::) { hero Gol) G$ >::; hero items 7))(swor)); hero 7ttac+Famage <$ ?; Console !riteLine("Ihan+ you {:'#"9 hero %)enti5ier); ' else {

enough money

that#");

Console !riteLine("8ou )onDt ha(e Come bac+ when ya )o"); ' ' else { Console !riteLine("8ouD(e alrea)y got ' brea+; case "H"3 case "h"3 chec+item $ hero Chec+%tems(helmet); i5 (chec+item $$ 5alse) { i5 (hero Gol) >$ J:) { hero Gol) G$ J:; hero items 7))(helmet); hero Fe5ense <$ >; Console !riteLine("Ihan+ you {:'#"9 ' else {

hero %)enti5ier);

enough money

Console !riteLine("8ou )onDt ha(e Come bac+ when ya )o"); ' ' else { Console !riteLine("8ouD(e alrea)y got ' brea+; case "7"3 case "a"3 chec+item $ hero Chec+%tems(armor); i5 (chec+item $$ 5alse) { i5 (hero Gol) >$ >?K) { hero Gol) G$ >?K;

that#");

hero %)enti5ier); ' else {

hero items 7))(armor); hero Fe5ense <$ J; Console !riteLine("Ihan+ you {:'#"9

enough money

Console !riteLine("8ou )onDt ha(e Come bac+ when ya )o"); ' ' else { Console !riteLine("8ouD(e alrea)y got ' brea+; case "F"3 case ")"3 Console !riteLine("Goo)bye9 an) be care5ul out

that#");

there#");

brea+; )e5ault3 Console !riteLine("% canDt un)erstan) that gibberish youDre sayinD"); brea+; ' ' while (choice #$ ")" AA choice #$ "F"); Console !riteLine("4ress enter to continue Console 2ea)Line();

");

' '

ie!
public class 0iew { public static (oi) 4rint/tats(Hero hero) { Console Clear(); Console !rite(*" Lame3{:' Hitpoints3 {>'B{?' Fe5ense3{J' 7ttac+3{M' =;perience3{K' Gol)3{N' %tems3"9 hero %)enti5ier9 hero CurrentHealth9 hero Ma;Health9 hero Fe5ense9 hero 7ttac+Famage9 hero =;perience9 hero Gol)); 5oreach (string item in hero items) { Console !riteLine(item); ' Console !riteLine(); Console !riteLine("4ress enter to continue "); Console 2ea)Line();

' '

Console Clear();

"attle
class Battle { string userspellchoice; string userchoice; string monsterchoice; string monsterspellchoice; int targetmonster; bool amonsterle5t; public Battle(Hero hero9 List<Character> monsters) { Console !riteLine("{:' is 5acing3"9 hero %)enti5ier); 5oreach (Character monster in monsters) { Console !riteLine("{:'"9 monster %)enti5ier); ' BattleLoop(hero9 monsters); ' public (oi) BattleLoop(Hero hero9 List<Character> monsters) { )o { Console !riteLine("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"); BattleHelper 4rint/tatus(hero); 5oreach (Character monster in monsters) { i5 (monster is7li(e) BattleHelper 4rint/tatus(monster); ' userchoice $ BattleHelper 4rintChoice(); Console !riteLine(); BattleHelper Chec+Fe5ence(userchoice9 hero); i5 (userchoice $$ "s" 66 userchoice $$ "/") { userspellchoice $ BattleHelper 4rint/pells(); ' else i5 (userchoice $$ "5" 66 userchoice $$ ".") { Console !riteLine("8ou ha(e 5le)"); Console !riteLine("4ress any +ey to continue"); hero 5le) $ true; continue; ' targetmonster $ BattleHelper ChooseIarget(monsters); BattleHelper 4rocessChoice(userchoice9 hero9 monstersPtargetmonsterQ9 userspellchoice); 5oreach (Character monster in monsters) { monster is7li(e $ BattleHelper Chec+Health(monster CurrentHealth);

i5 (monster is7li(e $$ true) { monsterchoice $ monster 7%(); BattleHelper Chec+Fe5ence(monsterchoice9 monster); "s") i5 (monsterchoice $$ "/" 66 monsterchoice $$ { ' monsterspellchoice $ monster /pell7%();

BattleHelper 4rocessChoice(monsterchoice9 monster9 hero9 monsterspellchoice); ' ' amonsterle5t $ BattleHelper Chec+Monsters(monsters); Console !riteLine("4ress enter to continue "); Console 2ea)Line(); Console Clear(); ' while (hero is7li(e $$ true AA amonsterle5t $$ true); ' '

"attlehelper
BBB <summary> BBB 7 collection o5 static metho)s use) in our battle loop BBB <Bsummary> class BattleHelper { static int )amage; static 2an)om ran); Rregion Chec+Health BBB <summary> BBB Ihis metho) shoul) be calle) 5or each character to )etermine i5 they are ali(e BBB 7 )ea) character shoul) not be allowe) to )o any actions BBB <Bsummary> BBB <param name$"health"> the characters current health int<Bparam> BBB <returns>2eturns i5 the character is ali(e<Breturns> public static bool Chec+Health(int health) { bool ali(e; i5 (health > :) { ali(e $ true; ' else { ali(e $ 5alse; ' return ali(e;

' Ren)region

Rregion FealFamage BBB <summary> BBB Ihis metho) calculates the )amage base) on the attac+ers attac+ power BBB (s the )e5en)ers )e5ence stat BBB <Bsummary> BBB <param name$"attac+er">Ihe attac+ing character<Bparam> BBB <param name$")e5en)er">Ihe )e5en)ing character<Bparam> BBB <returns><Breturns> public static int FealFamage(Character attac+er9 Character )e5en)er) { int ma;; int min; ran) $ new 2an)om(); ma; $ attac+er 7ttac+Famage G )e5en)er Fe5ense; i5 (ma; <$ :) { ma; $ >; ' min $ (int)(attac+er 7ttac+Famage O E) G )e5en)er Fe5ense; i5 (min <$ :) { min $ >; ' )amage $ ran) Le;t(min9 ma;); i5 (attac+er increase7ttac+ $$ true) { )amage $ (int)()amage O > K); ' i5 ()e5en)er )e5en)ing $$ true) { )amage $ )amage B ?; ' return )amage; ' Ren)region Rregion 4rocessChoice BBB <summary> BBB Ihis metho) is use) to ta+e the choice an) )etermine the right action 5or it BBB <Bsummary> BBB <param name$"choice"> the attac+ers choice<Bparam> BBB <param name$"attac+er">Ihe acti(e character<Bparam> BBB <param name$")e5en)er">Ihe target character the attac+er is attac+ing<Bparam> public static (oi) 4rocessChoice(string choice9 Character attac+er9 Character )e5en)er9 string spellchoice) { switch (choice) { case "7"3 case "a"3 Console !riteLine();

Console !riteLine("{:' attac+s#"9 attac+er %)enti5ier); FealFamage(attac+er9 )e5en)er); )e5en)er CurrentHealth G$ )amage; Console !riteLine("{:' hits the {>' 5or {?'hp o5 )amage" 9 attac+er %)enti5ier9 )e5en)er %)enti5ier9 )amage); brea+; case "F"3 case ")"3 Console !riteLine(); Console !riteLine("{:' )e5en)s#"9 attac+er %)enti5ier); brea+; case "."3 case "5"3 Console !riteLine(); Console !riteLine("{:' 5lees#"9 attac+er %)enti5ier); attac+er 5le) $ true; attac+er is7li(e $ 5alse; brea+; case "/"3 case "s"3 Console !riteLine(); Cast/pell(attac+er9 )e5en)er9 spellchoice); brea+; )e5ault3 Console !riteLine("%Dm sorry9 % )i)nDt recogni&e that "); Console !riteLine(); choice $ 4rintChoice(); Console !riteLine(); 4rocessChoice(choice9 attac+er9 )e5en)er9 spellchoice); brea+; ' ' Ren)region Rregion 4rint/tatus BBB <summary> BBB Ihis metho) is use) to print the status o5 both characters BBB <Bsummary> BBB <param name$"hero">Cur hero character<Bparam> BBB <param name$"monster">the monster character<Bparam> public static (oi) 4rint/tatus(Character hero) { Console !rite(*" H4BMa;H4 M4BMa;M4 {:'3 {>'B{?'hp {J'B{M'mp OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO "9 hero %)enti5ier9 hero CurrentHealth9 hero Ma;Health9 hero CurrentMagic9 hero Ma;Magic); ' Ren)region

Rregion 4rintChoice BBB <summary> BBB Ihis metho) prints our choices an) gets the choice BBB <Bsummary> BBB <returns>returns the string o5 the heroDs choice<Breturns> public static string 4rintChoice() { string choice; Console !riteLine(); Console !rite(*" --------------------4lease choose an action3 (7)ttac+3 (F)e5en)3 (/)pell3 (.)lee3 ---------------------"); Console !riteLine(); choice $ Console 2ea)Line(); return choice; ' Ren)region Rregion Chec+Fe5ence BBB <summary> BBB Ihis metho) shoul) be calle) 5or each acti(e character Ihis sets BBB the bools )e5en)ing an) increase attac+ 5or the character BBB Ihis metho) shoul) be calle) prior to any processchoice BBB <Bsummary> BBB <param name$"choice">input the string choice to chec+ 5or )e5ence<Bparam> BBB <param name$"attac+er">input the acti(e character we are chec+ing<Bparam> public static (oi) Chec+Fe5ence(string choice9 Character attac+er) { i5 (attac+er )e5en)ing $$ true) { attac+er increase7ttac+ $ true; ' else { attac+er increase7ttac+ $ 5alse; ' i5 (choice $$ "F" 66 choice $$ ")") { attac+er )e5en)ing $ true; ' else { attac+er )e5en)ing $ 5alse; ' '

Ren)region Rregion Cast/pell BBB <summary> BBB Here we going to "cast" the spell BBB <Bsummary> BBB <param name$"attac+er">Ihe attac+er<Bparam> BBB <param name$")e5en)er">Ihe )e5en)er<Bparam> BBB <param name$"spell">Ihe spell theyD(e chosen to cast<Bparam> public static (oi) Cast/pell(Character attac+er9 Character )e5en)er9 string spellchoice) { /pell spell; spell $ 4rocess/pellChoice(spellchoice9 attac+er); int spellpower $ spell /pellCast(attac+er); i5 (spell isCn/el5 $$ true) { attac+er CurrentHealth <$ spellpower; i5 (attac+er CurrentHealth > attac+er Ma;Health) { attac+er CurrentHealth $ attac+er Ma;Health; ' ' else i5 (spell multipleHits $$ true) { )e5en)er CurrentHealth G$ spellpower; BBIo Fo3 ma+e it hit multiple enemies ' else i5 (spell singleIarget $$ true) { )e5en)er CurrentHealth G$ spellpower; ' ' Ren)region Rregion 4rint/pells BBB <summary> BBB 7 metho) to print out the spells to choose 5rom BBB <Bsummary> BBB <returns>7 string o5 the spell choice<Breturns> public static string 4rint/pells() { Console !riteLine(); string spellchoice; Console !rite(*" 4lease choose a spell3 OOOOOOOOOOOOOOOOOOOOOOO (H)eal (.)ireball (%)cebolt OOOOOOOOOOOOOOOOOOOOOOO"); Console !riteLine(); spellchoice $ Console 2ea)Line(); return spellchoice; ' Ren)region

Rregion 4rocess/pellChoice BBB <summary> BBB 7 metho) to )etermine which spell shoul) be cast BBB <Bsummary> BBB <param name$"spellchoice">Ihe spellchoice<Bparam> BBB <param name$"attac+er">the attac+er<Bparam> BBB <param name$")e5en)er">the )e5en)er<Bparam> public static /pell 4rocess/pellChoice(string spellchoice9 Character attac+er) { /pell spell; switch (spellchoice) { case "H"3 case "h"3 Heal heal $ new Heal(); return heal; case "."3 case "5"3 .ireball 5ireball $ new .ireball(); return 5ireball; case "%"3 case "i"3 %cebolt icebolt $ new %cebolt(); return icebolt; )e5ault3 Console !riteLine(); Console !riteLine("%Dm sorry that wasnDt a (ali) choice"); spellchoice $ 4rint/pells(); spell $ 4rocess/pellChoice(spellchoice9 attac+er); brea+; ' return spell; ' Ren)region Rregion Chec+Monsters BBB <summary> BBB Ihis metho) ma+es sure at least one monster is ali(e to continue the battle BBB <Bsummary> BBB <param name$"Monsters"><Bparam> public static bool Chec+Monsters(List<Character> Monsters) { bool 5oun)one $ 5alse; 5oreach (Character monster in Monsters) { i5 (monster is7li(e) { 5oun)one $ true; ' ' i5 (5oun)one)

{ ' else { '

return true;

return 5alse;

' Ren)region Rregion ChooseIarget BBB <summary> BBB Ihis metho) will print out the current monster with an in)e; BBB so the attac+er can choose which one to target BBB <Bsummary> BBB <param name$"Monster">Ihis is the list o5 monsters<Bparam> BBB <returns>2eturns an in)e; o5 the character to attac+<Breturns> public static int ChooseIarget(List<Character> Monster) { Console !riteLine("4lease choose the monster to attac+"); string choice; int ; $ :; 5oreach (Character monster in Monster) { ;<<; i5 (monster is7li(e) { Console !riteLine("{:'3 {>'"9 ;9 monster %)enti5ier); ' ' Console !riteLine(); choice $ Console 2ea)Line(); BBbelow is an e;ample o5 e;ception BBhan)ling tryBBtry this stu55 { ; $ int 4arse(choice); ' catch (=;ception)BBi5 problem try this { Console !riteLine("%n(ali) choice"); ; $ ChooseIarget(Monster); ;<<; ' 5inallyBB5inally when it wor+s )o this { ; G$ >; ' return ;; ' Ren)region '

Spell

class /pell { public int power;BBIhis is 5or the base potency o5 the spell public int magicCost;BBthis is how much H4 it costs to cast the spell public bool multipleHits9 singleIarget9 isCn/el5;BBIhese are to )etermine how to use the spell public bool 5ire9 ice9 lightning;BBIhese woul) be use) i5 you want elemental )e5ense an) wea+ness public string i)enti5ier; public /pell() { multipleHits $ 5alse; singleIarget $ 5alse; isCn/el5 $ 5alse; 5ire $ 5alse; ice $ 5alse; lightning $ 5alse; ' public (irtual int /pellCast(Character caster) { return power; '

'

#ireball
class .ireball 3 /pell { public .ireball() { base i)enti5ier $ ".ireball"; base multipleHits $ true; base power $ >:; base magicCost $ K; ' public o(erri)e int /pellCast(Character Caster) { Console !riteLine("{:' casts 5ireball9"9 Caster %)enti5ier); Caster CurrentMagic G$ magicCost; i5 (Caster CurrentMagic < :) { Caster CurrentMagic <$ magicCost; Console !riteLine("howe(er {:' )oesnDt ha(e enough magic points"9 Caster %)enti5ier); power $ :; ' else i5 (Caster CurrentMagic >$ :) { Console !riteLine("an) hits 5or {:'hp o5 5ire )amage"9 power); ' return power; '

'

Icebolt
class %cebolt 3 /pell { public %cebolt() { base i)enti5ier $ "%cebolt"; base power $ >?; base singleIarget $ true; base magicCost $ ?; ' public o(erri)e int /pellCast(Character Caster) { Console !riteLine("{:' casts %cebolt9"9 Caster %)enti5ier); Caster CurrentMagic G$ magicCost; i5 (Caster CurrentMagic < :) { Caster CurrentMagic <$ magicCost; Console !riteLine("howe(er {:' )oesnDt ha(e enough magic points"9 Caster %)enti5ier); power $ :; ' else i5 (Caster CurrentMagic >$ :) { Console !riteLine("an) hits 5or {:'hp o5 ice )amage"9 power); ' return power; '

'

$eal
class Heal 3 /pell { public Heal() { base i)enti5ier $ "Heal"; base isCn/el5 $ true; base power $ J:; base magicCost $ J; ' public o(erri)e int /pellCast(Character Caster) { Console !riteLine("{:' casts heal9"9 Caster %)enti5ier); Caster CurrentMagic G$ magicCost; i5 (Caster CurrentMagic < :) { Caster CurrentMagic <$ magicCost; Console !riteLine("howe(er {:' )oesnDt ha(e enough magic points"9Caster %)enti5ier); power $ :; ' else i5 (Caster CurrentMagic >$ :) { Console !riteLine("an) heals {:'hp"9 power); '

return power; ' '

%haracter
public class Character { public bool )e5en)ing9increase7ttac+; protecte) 2an)om ran); protecte) int 7i7ttac+9 7iFe5en)9 7i/pell; public int CurrentHealth9 Ma;Health9 CurrentMagic; public int Ma;Magic9 /trength9 Fe5ense9 7gility; public int =;perience9 Gol)9 7ttac+Famage; public string %)enti5ier; public bool is7li(e; protecte) int spellCne9 spellIwo9 spellIhree; public bool 5le); public Character() { spellCne $ :; spellIwo $ :; spellIhree $ :; )e5en)ing $ 5alse; increase7ttac+ $ 5alse; 5le) $ 5alse; ' public (irtual string 7%() { string choice $ ""; return choice; ' public (irtual string /pell7%() { string choice $ ""; return choice; '

'

$ero
public class Hero 3 Character { public List<string> items; public Hero() { items $ new List<string>(); ' public static (oi) %nitiali&e(Hero hero) { hero CurrentHealth $ >E; hero Ma;Health $ >E; hero CurrentMagic $ E; hero Ma;Magic $ E; hero /trength $ >:;

hero Fe5ense $ J; hero 7gility $ N; hero =;perience $ :; hero Gol) $ :; while (hero %)enti5ier $$ null 66 hero %)enti5ier $$ ""66 hero %)enti5ier $$ " ") { Console !riteLine("!hat is your HeroDs name,"); hero %)enti5ier $ Console 2ea)Line(); ' hero is7li(e $ true; hero 7ttac+Famage $ hero /trength; ' public bool Chec+%tems(string item) { i5 (items Contains(item)) { return true; ' else { return 5alse; ' ' '

Mage
class Mage 3 Character { public Mage() { base 7i7ttac+ $ KK; base 7iFe5en) $ NK; base 7i/pell $ SK; base spellCne $ JK; base spellIwo $ TK;

'

base base base base base base base base base base base base

CurrentHealth $ >E; Ma;Health $ >E; CurrentMagic $ >T; Ma;Magic $ >T; /trength $ K; Fe5ense $ J; 7gility $ N; =;perience $ ?:; Gol) $ >K; %)enti5ier $ "Mage"; is7li(e $ true; 7ttac+Famage $ /trength;

public o(erri)e string 7%() { string choice; int ainumberchoice;

ran) $ new 2an)om(); ainumberchoice $ ran) Le;t(>9 >::); i5 (ainumberchoice < base 7i7ttac+) { choice $ "7"; ' else i5 (ainumberchoice <$ base 7iFe5en) AA ainumberchoice >$ base 7i7ttac+) { choice $ "F"; ' else i5 (ainumberchoice < base 7i/pell AA ainumberchoice > base 7iFe5en)) { choice $ "/"; ' else { choice $ "."; ' return choice; ' public o(erri)e string /pell7%() { i5 (base CurrentHealth < (base CurrentHealth B ?)) {BBhere weDre gi(ing the mage a bit o5 common sense to heal spellCne B$ ?; spellIwo B$ ?; ' string choice; int ainumberchoice; ran) $ new 2an)om(); ainumberchoice $ ran) Le;t(>9 >::); i5 (ainumberchoice < base spellCne) { choice $ "."; ' else i5 (ainumberchoice <$ base spellIwo AA ainumberchoice >$ base spellCne) { choice $ "%"; ' else { choice $ "H"; ' return choice; ' '

Slime
class /lime 3 Character { public /lime() {BBIruth be tol) the slime was our orignial monster base 7i7ttac+ $ S:;

base 7iFe5en) $ >::; base 7i/pell $ :; base base base base base base base base base base base base ' public o(erri)e string 7%() { string choice; int ainumberchoice; ran) $ new 2an)om(); ainumberchoice $ ran) Le;t(>9 >::); i5 (ainumberchoice < base 7i7ttac+) { choice $ "7"; ' else i5 (ainumberchoice <$ base 7iFe5en) AA ainumberchoice >$ base 7i7ttac+) { choice $ "F"; ' else i5 (ainumberchoice < base 7i/pell AA ainumberchoice > base 7iFe5en)) { choice $ "/"; ' else { choice $ "."; ' return choice; ' ' CurrentHealth $ E; Ma;Health $ E; CurrentMagic $ :; Ma;Magic $ :; /trength $ K; Fe5ense $ J; 7gility $ M; =;perience $ K; Gol) $ ?; %)enti5ier $ "/lime"; is7li(e $ true; 7ttac+Famage $ /trength;

"arbarian
class Barbarian 3 Character { public Barbarian() { base 7i7ttac+ $ SK; base 7iFe5en) $ >:>; base 7i/pell $ :; base CurrentHealth $ ?K; base Ma;Health $ ?K; base CurrentMagic $ :;

'

base base base base base base base base base

Ma;Magic $ :; /trength $ >?; Fe5ense $ K; 7gility $ M; =;perience $ ?K; Gol) $ ?:; %)enti5ier $ "Barbarian"; is7li(e $ true; 7ttac+Famage $ /trength;

public o(erri)e string 7%() { string choice; int ainumberchoice; ran) $ new 2an)om(); ainumberchoice $ ran) Le;t(>9 >::); i5 (ainumberchoice < base 7i7ttac+) { choice $ "7"; ' else i5 (ainumberchoice <$ base 7iFe5en) AA ainumberchoice >$ base 7i7ttac+) { choice $ "F"; ' else i5 (ainumberchoice < base 7i/pell AA ainumberchoice > base 7iFe5en)) { choice $ "/"; ' else { choice $ "."; ' return choice; ' '

S-ar putea să vă placă și