C
C#11mo ago
dkyan33

Problem with Pokemon Game for school

Hello, I have a problem while creating a pokemon battle game as a school project and I can't figure out how to fix it is there anyone that can help me?
38 Replies
Deneri
Deneri11mo ago
Lots of people could help you, but you need to be more specific about what problem you are having.
Buddy
Buddy11mo ago
$details
MODiX
MODiX11mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
dkyan33
dkyan33OP11mo ago
I can't create enough files on that website it has multiple classes. Is there a way I can just put my visual studio solution here ?
Buddy
Buddy11mo ago
No, please avoid posting the entire codebase Only paste the code that has the issue and important code that is attached to it
dkyan33
dkyan33OP11mo ago
No description
dkyan33
dkyan33OP11mo ago
If you need more code to understand it, ask me and I will send it
Buddy
Buddy11mo ago
As it says It expects arguments A name, a type, etc.
dkyan33
dkyan33OP11mo ago
but if I try to add arguments it won't take any
Buddy
Buddy11mo ago
Huh? Send the Move class please
MODiX
MODiX11mo ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
dkyan33
dkyan33OP11mo ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PRB.PokemonBatlle;

namespace PRB.PokemonBatlle
{
public class Move : Pokemon
{
public Move(string name, Type pokemonType, int healthPoints, int attack, int defense, int speed, List<Move> moves) : base(name, pokemonType, healthPoints, attack, defense, speed, moves)
{

}

public new string Name { get; set; }
public new Type Type { get; set; }

public int Accuracy { get; set; }

public int Power { get; set; }

public int PowerPoints { get; set; }
public bool MakesContact { get; set; }


public new void Moves(string name, Type type, int accuracy, int power, int powerPoints, bool makesContact)
{


if (power < 0 || power > 250)
throw new ArgumentOutOfRangeException("Power moet tussen de 0 en 250 zijn!");
if (accuracy < 30 || accuracy > 100)
throw new ArgumentOutOfRangeException("Accuracy moet tussen de 30 en de 100 zijn!");

if (powerPoints < 0)
powerPoints = 0;


Name = name;
Type = type;
Accuracy = accuracy;
Power = power;
PowerPoints = powerPoints;
MakesContact = makesContact;
}

public string GetInfo()
{
return $"Move: {Name}, Type: {Type}, Accuracy: {Accuracy}, Power: {Power}";

}

public string GetMoveBatlleInfo()
{
return $"Move: {Name}, PowerPoints: {PowerPoints}/{PowerPoints}, Type: {Type}";
}




}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PRB.PokemonBatlle;

namespace PRB.PokemonBatlle
{
public class Move : Pokemon
{
public Move(string name, Type pokemonType, int healthPoints, int attack, int defense, int speed, List<Move> moves) : base(name, pokemonType, healthPoints, attack, defense, speed, moves)
{

}

public new string Name { get; set; }
public new Type Type { get; set; }

public int Accuracy { get; set; }

public int Power { get; set; }

public int PowerPoints { get; set; }
public bool MakesContact { get; set; }


public new void Moves(string name, Type type, int accuracy, int power, int powerPoints, bool makesContact)
{


if (power < 0 || power > 250)
throw new ArgumentOutOfRangeException("Power moet tussen de 0 en 250 zijn!");
if (accuracy < 30 || accuracy > 100)
throw new ArgumentOutOfRangeException("Accuracy moet tussen de 30 en de 100 zijn!");

if (powerPoints < 0)
powerPoints = 0;


Name = name;
Type = type;
Accuracy = accuracy;
Power = power;
PowerPoints = powerPoints;
MakesContact = makesContact;
}

public string GetInfo()
{
return $"Move: {Name}, Type: {Type}, Accuracy: {Accuracy}, Power: {Power}";

}

public string GetMoveBatlleInfo()
{
return $"Move: {Name}, PowerPoints: {PowerPoints}/{PowerPoints}, Type: {Type}";
}




}
}
Buddy
Buddy11mo ago
What exactly isnt working?
dkyan33
dkyan33OP11mo ago
the whole program that's the problem. And I don't know why but it has 31 errors in total
Buddy
Buddy11mo ago
And the errors are?
dkyan33
dkyan33OP11mo ago
is there a way I can copy them all and put them here?
Buddy
Buddy11mo ago
You can screenshot them
dkyan33
dkyan33OP11mo ago
No description
No description
Buddy
Buddy11mo ago
If you use a newer .NET version you can use Random.Shared Otherwise you must initialize a new object of type Random Random rand = new Random(); You must read the errors and do as it says
dkyan33
dkyan33OP11mo ago
random shared still gives an error
No description
Buddy
Buddy11mo ago
It is not a method It is a static property
dkyan33
dkyan33OP11mo ago
No description
Buddy
Buddy11mo ago
Make a dot after Shared then check the intellisense Shared is a shared instance of Random, it does not return a random number.
dkyan33
dkyan33OP11mo ago
what am I looking for in the intellisense?
Buddy
Buddy11mo ago
You tell me, what are you looking for?
dkyan33
dkyan33OP11mo ago
that it generates a random number and if it is lower than Accuracy it gos into the if statement
Buddy
Buddy11mo ago
Then find a method which generates a random number
dkyan33
dkyan33OP11mo ago
No description
dkyan33
dkyan33OP11mo ago
it said this return a non negative integer and then I get this error
Buddy
Buddy11mo ago
How do you call a method? Accuracy is an integer (32-bit integer), why do you need a long (64-bit integer)
dkyan33
dkyan33OP11mo ago
intellisense didn't give me a 32 bit option
Buddy
Buddy11mo ago
Are you sure? What does Next method say?
dkyan33
dkyan33OP11mo ago
that gives also an error
dkyan33
dkyan33OP11mo ago
No description
dkyan33
dkyan33OP11mo ago
I have to drive home now so I won't be able to answer for a moment, but I already want to thank you in advance for helping me out
Buddy
Buddy11mo ago
It still is a method Anything you call needs (2) certain characters
dkyan33
dkyan33OP11mo ago
this works now thank you
dkyan33
dkyan33OP11mo ago
but how do I fix this?
No description
Want results from more Discord servers?
Add your server