-
Notifications
You must be signed in to change notification settings - Fork 0
/
PokeDex.swift
54 lines (41 loc) · 1.49 KB
/
PokeDex.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//PokeDex project from Codecademy
class Pokemon {
var num = 0
var name = ""
var type = [""]
var ability = [""]
init(num:Int, name: String, type: [String], ability: [String]){
self.num = num
self.name = name
self.type = type
self.ability = ability
}
func displayPokemon(){
print("No. \(num)")
print("Name: \(name)")
print("Type: \(type)")
print("Abilities: \(ability)")
}
}
class GigantamaxPokemon: Pokemon {
var location = ""
init(num:Int, name: String, type: [String], ability: [String], location: String){
self.location = location
super.init(num: num, name: name, type: type, ability: ability)
}
override func displayPokemon(){
print("No. \(num)")
print("Name: \(name)")
print("Type: \(type)")
print("Abilities: \(ability)")
print("Location \(location)")
}
}
var bulbasaur = Pokemon(num: 1, name: "Bulbasaur", type: ["Grass 🌱", "Poison 💀"], ability: ["Overgrow"])
var charmander = Pokemon(num: 2, name: "Charmander", type: ["Fire 🔥"], ability: ["Blaze"])
var squirtle = Pokemon(num: 3, name: "Squirtle", type: ["Water 💧"], ability: ["Torrent"])
var Charizard = GigantamaxPokemon(num: 4, name: "Charizard",type: ["Fire 🔥"], ability: ["Blaze"], location: "Lake of Outrage")
Charizard.displayPokemon()
bulbasaur.displayPokemon()
charmander.displayPokemon()
squirtle.displayPokemon()