在过去的几天里,我已经弄清楚了如何做大部分这些事情,但这就是我所拥有的全部经验,所以这可能很简单。无论如何,一切都很顺利,直到我试图使一些公式复杂化,或者至少改变他们使用的值。这是我正在使用的。
class EnemyStats():
def Ename(self):
return #Not sure What i should put in these spots...
def EBaseDodge(self):
return
def EnemyEvasion(self):
return
def ENickRange(self):
return
def EBaseAttack(self):
return
def EWeaponAttack(self):
return
def EAttackRating(self):
return
def EnemyDefense(self):
return
def EAttackDamage(self):
return
def Damage(self):
return ((PAttackDamage-EnemyDefense)if (PAttackDamage-EnemyDefense>0) else 0);
def EDamage(self):
return ((EAttackDamage-PDefense) if ((EAttackDamage-PDefense)>0) else 0);
def LightAttackDamage(self):
return int(LightAttackDamage == (Damage * 0.72));
def HeavyAttackDamage(self):
return (Damage * 1.28);
def LightNicked(self):
return (LightAttackDamage/2);
def HeavyNicked(self):
return (HeavyAttackDamage/2);
def Nicked(self):
return (Damage/2)
def Estats(self):
Ename = raw_input('Target Enemy Name: ');
EBaseDodge = int(raw_input('Enter Enemy Dodge: '));
EnemyEvasion = int(raw_input('Enter Enemy Evasion: '));
ENickRange = (EBaseDodge + EnemyEvasion);
EBaseAttack = int(raw_input('Enter Enemy Base Attack: '));
EWeaponAttack = int(raw_input('Enter Enemy Weapon Attack(If N/A, 0): '));
EAttackRating = (EBaseAttack + EWeaponAttack);
EnemyDefense = int(raw_input('Enter Enemy Defense: '));
EAttackDamage = int(raw_input('Enter Enemy Attack Damage: '));
Damage = ((PAttackDamage-EnemyDefense)if (PAttackDamage-EnemyDefense>0) else 0);
EDamage = ((EAttackDamage-PDefense) if ((EAttackDamage-PDefense)>0) else 0);
LightAttackDamage = (Damage * 0.72);
HeavyAttackDamage = (Damage * 1.28);
LightNicked = (LightAttackDamage/2);
HeavyNicked = (HeavyAttackDamage/2);
Nicked = (Damage/2)
然后它被this引用。
def PLightAttackForm():#light attack
print 'Light attack!';
d = dice()
lightbase = d.LightAttack()
EE = EnemyStats()
if lightbase <= EE.EBaseDodge:
print 'You rolled', lightbase, ', Miss!', 0, 'Damage!'
elif lightbase > EE.ENickRange:
print 'You rolled', lightbase, ', Hit!', EE.LightAttackDamage, 'Damage!'
elif lightbase < EE.ENickRange:
print 'You rolled', lightbase, ', Nicked!', EE.LightNicked, 'Damage!'
else:
print lightbase
一切都很棒,没有错误,但我明白了。
轻攻击!你投了700,小姐!0伤害!#应该是命中和伤害
普通攻击!你投了 278 ,小姐!0伤害!#应该受到打击和伤害
重击!你投了 135 ,小姐!0 伤害!#should be a Nick and damage
我敢肯定这只是我不知道的事情,但如果你能帮助我,那就太棒了!谢谢!
另外,这是我编写的所有代码。可能有一些冗余......:D
import random
Name = raw_input("Enter Name: ")
#EName===
#EBaseDodge = int(raw_input("Enter Enemy Dodge: "))
PBaseDodge = int(input('Enter Base Dodge: '))
#EnemyEvasion = int(raw_input("Enter Enemy Evasion: "))
PEvasion = int(input('Enter Evasion: '))
#ENickRange = (EBaseDodge + EnemyEvasion)
PNickRange = (PBaseDodge + PEvasion)
PBaseAttack = int(raw_input("Enter Base Attack: "))
#EBaseAttack===
PWeaponAttack = int(raw_input("Enter Weapon Attack: "))
#EWeaponAttack===
PAttackRating = (PBaseAttack + PWeaponAttack)
#EAttackRating = (EBaseAttack + EWeaponAttack)
#EnemyDefense = int(raw_input("Enter Enemy Defense: "))
PDefense = int(input('Enter Defense: '))
PAttackDamage = int(raw_input("Enter Attack Damage: "))
#EAttackDamage===
#Damage = (PAttackDamage-EnemyDefense)
#EDamage = (EAttackDamage-PDefense)
#LightAttackDamage = (Damage * 0.72)
#HeavyAttackDamage = (Damage * 1.28)
#LightNicked = (LightAttackDamage/2)
#HeavyNicked = (HeavyAttackDamage/2)
#Nicked = Damage/2
class dice():
def NormalAttack(self):
return random.randint(1, PAttackRating);
def LightAttack(self):
return random.randint(1, (int(PAttackRating*1.25)));
def HeavyAttack(self):
return random.randint(1, (int(PAttackRating*0.75)));
#def att():
# d = dice()
# base = d.roll()
# if base <= a:
# print 'You rolled', base, ', Miss!', 0, 'Damage!'
# elif base > b:
# print 'You rolled', base, ', Hit!', Damage, 'Damage!'
# elif base < b:
# print 'You rolled', base, ', Nicked!', Nicked, 'Damage!'
# else:
# print base
####################NEW CODE#######################################
def Menu():
print '(1)Attack';
print '(2)Choose Enemy';
print '(3)Charge';
print '(4)Item';
def select():
choice = input('Enter Choice: ');
EE = EnemyStats()
if (choice == 1):
Attacktype();
elif (choice == 2):
EE.Estats();
elif (choice == 3):
Charge();
elif (choice == 4):
ItemSelection();
else:
print 'There are Numbers for a reason Nuub!',;
##############Enemy Stats############
class EnemyStats():
def Ename(self):
return
def EBaseDodge(self):
return
def EnemyEvasion(self):
return
def ENickRange(self):
return
def EBaseAttack(self):
return
def EWeaponAttack(self):
return
def EAttackRating(self):
return
def EnemyDefense(self):
return
def EAttackDamage(self):
return
def Damage(self):
return ((PAttackDamage-EnemyDefense)if (PAttackDamage-EnemyDefense>0) else 0);
def EDamage(self):
return ((EAttackDamage-PDefense) if ((EAttackDamage-PDefense)>0) else 0);
def LightAttackDamage(self):
return int(LightAttackDamage == (Damage * 0.72));
def HeavyAttackDamage(self):
return (Damage * 1.28);
def LightNicked(self):
return (LightAttackDamage/2);
def HeavyNicked(self):
return (HeavyAttackDamage/2);
def Nicked(self):
return (Damage/2)
def Estats(self):
Ename = raw_input('Target Enemy Name: ');
EBaseDodge = int(raw_input('Enter Enemy Dodge: '));
EnemyEvasion = int(raw_input('Enter Enemy Evasion: '));
ENickRange = (EBaseDodge + EnemyEvasion);
EBaseAttack = int(raw_input('Enter Enemy Base Attack: '));
EWeaponAttack = int(raw_input('Enter Enemy Weapon Attack(If N/A, 0): '));
EAttackRating = (EBaseAttack + EWeaponAttack);
EnemyDefense = int(raw_input('Enter Enemy Defense: '));
EAttackDamage = int(raw_input('Enter Enemy Attack Damage: '));
Damage = ((PAttackDamage-EnemyDefense)if (PAttackDamage-EnemyDefense>0) else 0);
EDamage = ((EAttackDamage-PDefense) if ((EAttackDamage-PDefense)>0) else 0);
LightAttackDamage = (Damage * 0.72);
HeavyAttackDamage = (Damage * 1.28);
LightNicked = (LightAttackDamage/2);
HeavyNicked = (HeavyAttackDamage/2);
Nicked = (Damage/2)
#Attacking
def Attacktype():
print '(1)LightAttack';
print '(2)NormalAttack';
print '(3)HeavyAttack';
print '(4)Use Dem Magicks';
print '(5)Menu(<<This is for nuublets)';
Attchoice = input('Enter Choice: ')
if (Attchoice == 1):
PLightAttackForm();
elif (Attchoice == 2):
PNormalAttackForm();
elif (Attchoice == 3):
PHeavyAttackForm();
elif (Attchoice == 4):
MagicMenu();
elif (Attchoice == 5):
Menu();
else:
print 'You wot M8?';
Menu();
def PLightAttackForm():#light attack
print 'Light attack!';
d = dice()
lightbase = d.LightAttack()
EE = EnemyStats()
if lightbase <= EE.EBaseDodge:
print 'You rolled', lightbase, ', Miss!', 0, 'Damage!'
elif lightbase > EE.ENickRange:
print 'You rolled', lightbase, ', Hit!', EE.LightAttackDamage, 'Damage!'
elif lightbase < EE.ENickRange:
print 'You rolled', lightbase, ', Nicked!', EE.LightNicked, 'Damage!'
else:
print lightbase
def PNormalAttackForm():#Normal attack
print 'Normal Attack!';
d = dice()
base = d.NormalAttack()
EE = EnemyStats()
if base <= EE.EBaseDodge:
print 'You rolled', base, ', Miss!', 0, 'Damage!'
elif base > EE.ENickRange:
print 'You rolled', base, ', Hit!', EE.Damage, 'Damage!'
elif base < EE.ENickRange:
print 'You rolled', base, ', Nicked!', EE.Nicked, 'Damage!'
else:
print base
def PHeavyAttackForm():#Heavy Attack
print 'Heavy Attack!';
d = dice()
heavybase = d.HeavyAttack()
EE = EnemyStats()
if heavybase <= EE.EBaseDodge:
print 'You rolled', heavybase, ', Miss!', 0, 'Damage!'
elif heavybase > EE.ENickRange:
print 'You rolled', heavybase, ', Hit!', EE.HeavyAttackDamage, 'Damage!'
elif heavybase < EE.ENickRange:
print 'You rolled', heavybase, ', Nicked!', EE.HeavyNicked, 'Damage!'
else:
print heavybase
def MagicMenu():#magic menu()
print 'Magic menu!';
##############Enemy Stats############
####################NEW CODE#######################################