Improving Types in this Code

BlitzMax Forums/BlitzMax Beginners Area/Improving Types in this Code




Type Bronze
	Field Name$="Bronze"
	Field Atk#=50
	Field Str#=25
	Field Skl#=2
End Type

Type Silver
	Field Name$="Silver"
	Field Atk#=100
	Field Str#=66
	Field Skl#=5
End Type

Type Gold
	Field Name$="Gold"
	Field Atk#=255
	Field Str#=32
	Field Skl#=9
End Type

Type Sword
	Field Name$="Sword"
	Field Speed=5
	Field Modif=20
End Type

Type Dagger
	Field Name$="Dagger"
	Field Speed=2
	Field Modif=12
End Type

Type Hammer
	Field Name$="Hammer"
	Field Speed=1
	Field Modif=24
End Type

Type Fire
	Field Name$="Fire"
	Field Dama$="X2 to Ice"
End Type

Type Ice
	Field Name$="Ice"
	Field Dama$="X2 to Fire"
End Type

Type Water
	Field Name$="Air"
	Field Dama$="X2 to Earth"
End Type

Type Earth
	Field Name$="Earth"
	Field Dama$="X2 to Air"
End Type

Type Weapon1

	Field WClass:Bronze=New Bronze
	Field WType:Sword=New Sword
	Field WElem:Fire=New Fire
	
	Method Print_Weapon()
	Print Wclass.Name$+" "+WType.name$+" of "+WElem.Name$
	End Method
	
End Type

Type Weapon2

	Field WClass:Silver=New Silver
	Field WType:Dagger=New Dagger
	Field WElem:ice=New ice
	
	Method Print_Weapon()
	Print Wclass.Name$+" "+WType.name$+" of "+WElem.Name$
	End Method
	
End Type


A:Weapon1=New Weapon1
a.Print_Weapon()
B:Weapon2=New Weapon2
B.print_Weapon()



Are there anyways the you could Change The WClass to include different types withouts Having To have to code as in weapon1 and weapon2

for instance having the Wclass Field but adding a type later