mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Guess that fusion quiz (not events)
This commit is contained in:
@@ -11,7 +11,7 @@ class FusionQuiz
|
||||
@sprites = {}
|
||||
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
|
||||
@previewwindow=nil
|
||||
@difficulty = difficulty
|
||||
@customs_list = getCustomSpeciesList(true, false)
|
||||
@selected_pokemon = nil
|
||||
@@ -22,31 +22,91 @@ class FusionQuiz
|
||||
@score = 0
|
||||
end
|
||||
|
||||
def start_quiz_round()
|
||||
def start_quiz(nb_rounds=3)
|
||||
round_multiplier = 1
|
||||
round_multiplier_increase = 0.1
|
||||
|
||||
|
||||
for i in 1..nb_rounds
|
||||
if i == nb_rounds
|
||||
pbMessage(_INTL("Get ready! Here comes the final round!"))
|
||||
elsif i ==1
|
||||
pbMessage(_INTL("Get ready! Here comes the first round!"))
|
||||
else
|
||||
pbMessage(_INTL("Get ready! Here comes round {1}!",i))
|
||||
end
|
||||
start_quiz_new_round(round_multiplier)
|
||||
|
||||
|
||||
rounds_left = nb_rounds-i
|
||||
if rounds_left >0
|
||||
pbMessage(_INTL("That's it for round {1}. You've accumulated {2} points so far.",i,@score))
|
||||
prompt_next_round = pbMessage(_INTL("Are you ready to move on to the next round?",i),["Yes","No"])
|
||||
if prompt_next_round != 0
|
||||
prompt_quit = pbMessage(_INTL("You still have {1} rounds to go. You'll only keep your points if you finish all {2} rounds. Do you really want to quit now?",rounds_left,nb_rounds),["Yes","No"])
|
||||
if prompt_quit
|
||||
pbMessage(_INTL("Well that's the show, folks. Make sure to tune in next time for some more Guess The Fusion!"))
|
||||
return
|
||||
end
|
||||
end
|
||||
round_multiplier += round_multiplier_increase
|
||||
else
|
||||
pbMessage(_INTL("That concludes our quiz! You've accumulated {1} points in total.",@score))
|
||||
pbMessage("Thanks for playing with us today!")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def start_quiz_new_round(round_multiplier=1)
|
||||
base_points_q1=300
|
||||
base_points_q1_redemption=100
|
||||
|
||||
base_points_q2=400
|
||||
base_points_q2_redemption=100
|
||||
|
||||
|
||||
pick_random_pokemon()
|
||||
show_fusion_picture(true)
|
||||
correct_answers=[]
|
||||
|
||||
#QUESTION 1
|
||||
new_question(500, "What Pokémon is this fusion's body?",@body_id,true)
|
||||
#OBSCURED
|
||||
correct_answers << new_question(base_points_q1*round_multiplier, "Which Pokémon is this fusion's body?",@body_id,true,true )
|
||||
pbMessage("Next question!")
|
||||
new_question(500,"What Pokémon is this fusion's head?", @head_id,true)
|
||||
correct_answers << new_question(base_points_q2*round_multiplier,"Which Pokémon is this fusion's head?", @head_id,true,true )
|
||||
@viewport.dispose
|
||||
|
||||
show_fusion_picture(false )
|
||||
#QUESTION 1
|
||||
new_question(200, "What Pokémon is this fusion's body?",@body_id,true)
|
||||
pbMessage("Next question!")
|
||||
new_question(200,"What Pokémon is this fusion's head?", @head_id,true)
|
||||
#NON-OBSCURED
|
||||
if !correct_answers[0] || !correct_answers[1]
|
||||
pbMessage("Okay, now's your chance to make up for the points you missed!")
|
||||
if !correct_answers[0] #1st question redemption
|
||||
new_question(base_points_q1_redemption, "Which Pokémon is this fusion's body?",@body_id,true,false )
|
||||
if !correct_answers[1]
|
||||
pbMessage("Next question!")
|
||||
end
|
||||
end
|
||||
|
||||
if !correct_answers[1] #2nd question redemption
|
||||
new_question(base_points_q2_redemption,"Which Pokémon is this fusion's head?", @head_id,true,false )
|
||||
end
|
||||
else
|
||||
pbMessage("A perfect round! Here's what this Pokémon looked like!")
|
||||
end
|
||||
hide_fusion_picture()
|
||||
@viewport.dispose
|
||||
|
||||
end
|
||||
|
||||
|
||||
def new_question(points_value,question, answer_id, should_generate_new_choices)
|
||||
def new_question(points_value,question, answer_id, should_generate_new_choices, other_chance_later)
|
||||
points_value=points_value.to_i
|
||||
answer_name = getPokemon(answer_id).real_name
|
||||
answered_correctly = give_answer(question,answer_id,should_generate_new_choices)
|
||||
award_points(points_value) if answered_correctly
|
||||
question_answer_followup_dialog(answered_correctly,answer_name,points_value,true)
|
||||
question_answer_followup_dialog(answered_correctly,answer_name,points_value,other_chance_later)
|
||||
return answered_correctly
|
||||
end
|
||||
|
||||
|
||||
@@ -56,32 +116,40 @@ class FusionQuiz
|
||||
end
|
||||
|
||||
def question_answer_followup_dialog(answered_correctly,correct_answer, points_awarded_if_win, other_chance_later=false)
|
||||
pbMessage("And the correct answer was...")
|
||||
pbMessage("...")
|
||||
pbMessage(_INTL("{1}!",correct_answer))
|
||||
if !other_chance_later
|
||||
pbMessage("And the correct answer was...")
|
||||
pbMessage("...")
|
||||
pbMessage(_INTL("{1}!",correct_answer))
|
||||
end
|
||||
|
||||
if answered_correctly
|
||||
pbMessage("That's a correct answer!")
|
||||
pbMessage(_INTL("You're awarded {1} points your answer. Your current score is {2}",points_awarded_if_win,@score.to_s))
|
||||
pbMessage(_INTL("You're awarded {1} points for your answer. Your current score is {2}",points_awarded_if_win,@score.to_s))
|
||||
else
|
||||
pbMessage("Unfortunately, you didn't get the answer right. ")
|
||||
pbMessage("But you'll get another chance later!") if other_chance_later
|
||||
pbMessage("Unfortunately, that was a wong answer.")
|
||||
pbMessage("But you'll get another chance!") if other_chance_later
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def show_fusion_picture(obscured = false)
|
||||
hide_fusion_picture()
|
||||
picturePath = get_fusion_sprite_path(@head_id, @body_id)
|
||||
bitmap = AnimatedBitmap.new(picturePath)
|
||||
bitmap.scale_bitmap(Settings::FRONTSPRITE_SCALE)
|
||||
previewwindow = PictureWindow.new(bitmap)
|
||||
previewwindow.y = 30
|
||||
previewwindow.x = 100
|
||||
previewwindow.z = 100000
|
||||
@previewwindow = PictureWindow.new(bitmap)
|
||||
@previewwindow.y = 30
|
||||
@previewwindow.x = 100
|
||||
@previewwindow.z = 100000
|
||||
if obscured
|
||||
previewwindow.picture.pbSetColor(255, 255, 255, 200)
|
||||
@previewwindow.picture.pbSetColor(255, 255, 255, 200)
|
||||
end
|
||||
end
|
||||
|
||||
def hide_fusion_picture()
|
||||
@previewwindow.dispose if @previewwindow
|
||||
end
|
||||
|
||||
def pick_random_pokemon(save_in_variable = 1)
|
||||
random_pokemon = getRandomCustomFusionForIntro(true, @customs_list)
|
||||
@head_id = random_pokemon[0]
|
||||
@@ -100,7 +168,7 @@ class FusionQuiz
|
||||
else
|
||||
player_answer = prompt_pick_answer_regular(prompt_message,answer_id,should_generate_new_choices)
|
||||
end
|
||||
confirmed = pbMessage("Is that your final answer?",["Yes","No"])
|
||||
confirmed = pbMessage("Is this your final answer?",["Yes","No"])
|
||||
if confirmed==0
|
||||
question_answered=true
|
||||
end
|
||||
@@ -111,7 +179,7 @@ class FusionQuiz
|
||||
def get_random_pokemon_from_same_egg_group(pokemon,previous_choices)
|
||||
egg_groups = getPokemonEggGroups(pokemon)
|
||||
while true
|
||||
new_pokemon = rand(NB_POKEMON+1)
|
||||
new_pokemon = rand(1,NB_POKEMON)+1
|
||||
new_pokemon_egg_groups = getPokemonEggGroups(new_pokemon)
|
||||
if (egg_groups & new_pokemon_egg_groups).any? && !previous_choices.include?(new_pokemon)
|
||||
return new_pokemon
|
||||
@@ -150,7 +218,10 @@ class FusionQuiz
|
||||
end
|
||||
pbMessage(prompt_message)
|
||||
#chosen = pbChooseList(commands, 0, nil, 1)
|
||||
end
|
||||
|
||||
def get_score
|
||||
return @score
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user